diff --git a/src/components/DatePicker/__snapshots__/DatePicker.test.js.snap b/src/components/DatePicker/__snapshots__/DatePicker.test.js.snap
index a75ebcfb..d6985555 100644
--- a/src/components/DatePicker/__snapshots__/DatePicker.test.js.snap
+++ b/src/components/DatePicker/__snapshots__/DatePicker.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/components/Layout/__snapshots__/Layout.test.js.snap b/src/components/Layout/__snapshots__/Layout.test.js.snap
index 273aa7fe..6154b6ba 100644
--- a/src/components/Layout/__snapshots__/Layout.test.js.snap
+++ b/src/components/Layout/__snapshots__/Layout.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/components/Navigation/Aside/__snapshots__/Aside.test.js.snap b/src/components/Navigation/Aside/__snapshots__/Aside.test.js.snap
index d6eaa551..1fc60c18 100644
--- a/src/components/Navigation/Aside/__snapshots__/Aside.test.js.snap
+++ b/src/components/Navigation/Aside/__snapshots__/Aside.test.js.snap
@@ -98,6 +98,20 @@ Object {
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/components/Navigation/NavBar/__snapshots__/NavBar.test.js.snap b/src/components/Navigation/NavBar/__snapshots__/NavBar.test.js.snap
index 3eaf6184..a23f4b26 100644
--- a/src/components/Navigation/NavBar/__snapshots__/NavBar.test.js.snap
+++ b/src/components/Navigation/NavBar/__snapshots__/NavBar.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/components/UserForm/__snapshots__/UserForm.test.js.snap b/src/components/UserForm/__snapshots__/UserForm.test.js.snap
index 95ef74a4..838bf00d 100644
--- a/src/components/UserForm/__snapshots__/UserForm.test.js.snap
+++ b/src/components/UserForm/__snapshots__/UserForm.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/languages/en.json b/src/languages/en.json
index fa9ddf0a..f4a82810 100644
--- a/src/languages/en.json
+++ b/src/languages/en.json
@@ -66,5 +66,19 @@
"UserForm.pickFile": "Pick a file",
"UserForm.submit": "Submit",
"UserForm.goBack": "Go Back",
- "UserForm.userPreview": "User Preview"
+ "UserForm.userPreview": "User Preview",
+ "auth/email-already-exists": "Email already in use",
+ "auth/invalid-email": "Email is invalid",
+ "auth/wrong-password": "Invalid credentials",
+ "auth/user-disabled": "User disabled",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
+ "utils.invalidEmail": "Invalid email"
}
diff --git a/src/languages/es.json b/src/languages/es.json
index ea7330ec..3b67b9c9 100644
--- a/src/languages/es.json
+++ b/src/languages/es.json
@@ -66,5 +66,19 @@
"UserForm.pickFile": "Elige un archivo",
"UserForm.submit": "Enviar",
"UserForm.goBack": "Regresar",
- "UserForm.userPreview": "Vista previa del usuario"
+ "UserForm.userPreview": "Vista previa del usuario",
+ "auth/email-already-exists": "Email ya esta siendo usado",
+ "auth/invalid-email": "El Email inválido",
+ "auth/wrong-password": "Credenciales inválidas",
+ "auth/user-disabled": "Usuario deshabilitado",
+ "auth/too-many-requests": "Demasiados intentos, intententelo más tarde",
+ "auth/expired-action-code": "El link de invitación expiró, contáctese con su administrador",
+ "auth/invalid-action-code": "El link de invitación expiró, contáctese con su administrador",
+ "storage/quota-exceeded": "Error interno del servidor, contáctese con su administrador",
+ "storage/unauthenticated": "Sin autenticación, por favor autentíquese e intente de nuevo",
+ "storage/unauthorized": "Sin autorización, no se encuentra autorizado para realizar esta acción",
+ "utils.default": "Error desconocido, contáctese con su administrador",
+ "utils.safePassword": "Contraseña segura",
+ "utils.unsafePassword": "Contraseña insegura",
+ "utils.invalidEmail": "Email inválido"
}
diff --git a/src/pages/Home/__snapshots__/Home.test.js.snap b/src/pages/Home/__snapshots__/Home.test.js.snap
index 3395932c..e5c4fc9b 100644
--- a/src/pages/Home/__snapshots__/Home.test.js.snap
+++ b/src/pages/Home/__snapshots__/Home.test.js.snap
@@ -76,6 +76,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
}
}
onError={[Function]}
diff --git a/src/pages/Login/__snapshots__/Login.test.js.snap b/src/pages/Login/__snapshots__/Login.test.js.snap
index 67620eb1..ec433609 100644
--- a/src/pages/Login/__snapshots__/Login.test.js.snap
+++ b/src/pages/Login/__snapshots__/Login.test.js.snap
@@ -76,6 +76,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
}
}
onError={[Function]}
diff --git a/src/pages/Login/index.jsx b/src/pages/Login/index.jsx
index 810178a7..56b74fc5 100644
--- a/src/pages/Login/index.jsx
+++ b/src/pages/Login/index.jsx
@@ -10,11 +10,12 @@ import paths from '../Router/paths';
import classes from './Login.module.scss';
const Login = () => {
- const { error, isAuth, loading } = useSelector(
+ const { error, isAuth, loading, locale } = useSelector(
state => ({
error: state.auth.error,
isAuth: !!state.auth.userData.id,
- loading: state.auth.loading
+ loading: state.auth.loading,
+ locale: state.preferences.locale
}),
shallowEqual
);
@@ -61,7 +62,7 @@ const Login = () => {
const modifierLoading = loading && 'is-loading';
const inputs = isEmailLink
- ? inputValidations(authData.email, authData.password)
+ ? inputValidations(authData.email, authData.password, locale)
: {
email: {
modifier: null,
diff --git a/src/pages/NotFound/__snapshots__/NotFound.test.js.snap b/src/pages/NotFound/__snapshots__/NotFound.test.js.snap
index a4b8b821..ff5c1b2b 100644
--- a/src/pages/NotFound/__snapshots__/NotFound.test.js.snap
+++ b/src/pages/NotFound/__snapshots__/NotFound.test.js.snap
@@ -76,6 +76,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
}
}
onError={[Function]}
diff --git a/src/pages/Profile/ChangePassword/__snapshots__/ChangePassword.test.js.snap b/src/pages/Profile/ChangePassword/__snapshots__/ChangePassword.test.js.snap
index fd6aa420..8b6d6067 100644
--- a/src/pages/Profile/ChangePassword/__snapshots__/ChangePassword.test.js.snap
+++ b/src/pages/Profile/ChangePassword/__snapshots__/ChangePassword.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/Profile/__snapshots__/Profile.test.js.snap b/src/pages/Profile/__snapshots__/Profile.test.js.snap
index a3c417e8..36f4e7b1 100644
--- a/src/pages/Profile/__snapshots__/Profile.test.js.snap
+++ b/src/pages/Profile/__snapshots__/Profile.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/ResetPassword/__snapshots__/ResetPassword.test.js.snap b/src/pages/ResetPassword/__snapshots__/ResetPassword.test.js.snap
index 2facaa24..b31cc961 100644
--- a/src/pages/ResetPassword/__snapshots__/ResetPassword.test.js.snap
+++ b/src/pages/ResetPassword/__snapshots__/ResetPassword.test.js.snap
@@ -76,6 +76,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
}
}
onError={[Function]}
diff --git a/src/pages/Router/PrivateRoute/__snapshots__/PrivateRoute.test.js.snap b/src/pages/Router/PrivateRoute/__snapshots__/PrivateRoute.test.js.snap
index 411d1857..ad289322 100644
--- a/src/pages/Router/PrivateRoute/__snapshots__/PrivateRoute.test.js.snap
+++ b/src/pages/Router/PrivateRoute/__snapshots__/PrivateRoute.test.js.snap
@@ -76,6 +76,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
}
}
onError={[Function]}
diff --git a/src/pages/Router/__snapshots__/Router.test.js.snap b/src/pages/Router/__snapshots__/Router.test.js.snap
index e15bda8f..1b386ebd 100644
--- a/src/pages/Router/__snapshots__/Router.test.js.snap
+++ b/src/pages/Router/__snapshots__/Router.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/Section/__snapshots__/Section.test.js.snap b/src/pages/Section/__snapshots__/Section.test.js.snap
index 84254836..e36f66da 100644
--- a/src/pages/Section/__snapshots__/Section.test.js.snap
+++ b/src/pages/Section/__snapshots__/Section.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/Submenu/__snapshots__/Submenu.test.js.snap b/src/pages/Submenu/__snapshots__/Submenu.test.js.snap
index 03bb09a8..125e6c4a 100644
--- a/src/pages/Submenu/__snapshots__/Submenu.test.js.snap
+++ b/src/pages/Submenu/__snapshots__/Submenu.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/User/__snapshots__/User.test.js.snap b/src/pages/User/__snapshots__/User.test.js.snap
index 4bf01aa7..daa8101a 100644
--- a/src/pages/User/__snapshots__/User.test.js.snap
+++ b/src/pages/User/__snapshots__/User.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/pages/Users/__snapshots__/Users.test.js.snap b/src/pages/Users/__snapshots__/Users.test.js.snap
index 879f372e..934b8f84 100644
--- a/src/pages/Users/__snapshots__/Users.test.js.snap
+++ b/src/pages/Users/__snapshots__/Users.test.js.snap
@@ -97,6 +97,20 @@ exports[` rendering should render without crashing 1`] = `
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
"Users.search": "Search:",
"Users.users": "Users",
+ "auth/email-already-exists": "Email already in use",
+ "auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
+ "auth/invalid-email": "Email is invalid",
+ "auth/too-many-requests": "Too many attempts made, try again later",
+ "auth/user-disabled": "User disabled",
+ "auth/wrong-password": "Invalid credentials",
+ "storage/quota-exceeded": "Internal server error, get in touch with your administrator",
+ "storage/unauthenticated": "Unauthenticated, please authenticate and try again",
+ "storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
+ "utils.default": "Unknown error, get in touch with your administrator",
+ "utils.invalidEmail": "Invalid email",
+ "utils.safePassword": "Safe password",
+ "utils.unsafePassword": "Unsafe password",
},
"onError": [Function],
"textComponent": Symbol(react.fragment),
diff --git a/src/state/actions/auth.js b/src/state/actions/auth.js
index fdd010af..6fceeba3 100644
--- a/src/state/actions/auth.js
+++ b/src/state/actions/auth.js
@@ -131,20 +131,23 @@ export const checkUserData = () => {
};
export const auth = (email, password) => {
- return async dispatch => {
+ return async (dispatch, getState) => {
dispatch(AUTH_SIGN_IN_INIT());
-
+ const { locale } = getState().preferences;
try {
await firebase.auth().signInWithEmailAndPassword(email, password);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
return dispatch(AUTH_SIGN_IN_FAIL({ error: errorMessage }));
}
const { emailVerified } = firebase.auth().currentUser;
if (!emailVerified) {
- const errorMessage = firebaseError(FIREBASE_RESPONSE.USER_DISABLED);
+ const errorMessage = firebaseError(
+ FIREBASE_RESPONSE.USER_DISABLED,
+ locale
+ );
return dispatch(AUTH_SIGN_IN_FAIL({ error: errorMessage }));
}
@@ -153,13 +156,14 @@ export const auth = (email, password) => {
};
export const setPassword = (email, password, url) => {
- return async dispatch => {
+ return async (dispatch, getState) => {
dispatch(AUTH_SET_PASSWORD_INIT());
+ const { locale } = getState().preferences;
try {
await firebase.auth().signInWithEmailLink(email, url);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
return dispatch(AUTH_SET_PASSWORD_FAIL({ error: errorMessage }));
}
@@ -168,7 +172,7 @@ export const setPassword = (email, password, url) => {
try {
await user.updatePassword(password);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
return dispatch(AUTH_SET_PASSWORD_FAIL({ error: errorMessage }));
}
@@ -179,13 +183,14 @@ export const setPassword = (email, password, url) => {
};
export const resetPassword = email => {
- return async dispatch => {
+ return async (dispatch, getState) => {
dispatch(AUTH_RESET_PASSWORD_INIT());
+ const { locale } = getState().preferences;
try {
await firebase.auth().sendPasswordResetEmail(email);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
return dispatch(AUTH_RESET_PASSWORD_FAIL({ error: errorMessage }));
}
@@ -196,8 +201,9 @@ export const resetPassword = email => {
export const authCleanUp = () => dispatch => dispatch(AUTH_CLEAN_UP());
export const changeUserPassword = (currentPassword, newPassword) => {
- return async dispatch => {
+ return async (dispatch, getState) => {
dispatch(AUTH_CHANGE_PASSWORD_INIT());
+ const { locale } = getState().preferences;
const user = firebase.auth().currentUser;
@@ -211,7 +217,7 @@ export const changeUserPassword = (currentPassword, newPassword) => {
try {
await user.reauthenticateWithCredential(credential);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
toastr.error('', errorMessage);
return dispatch(AUTH_CHANGE_PASSWORD_FAIL({ error: errorMessage }));
}
@@ -219,7 +225,7 @@ export const changeUserPassword = (currentPassword, newPassword) => {
try {
await user.updatePassword(newPassword);
} catch (error) {
- const errorMessage = firebaseError(error);
+ const errorMessage = firebaseError(error, locale);
toastr.error('', errorMessage);
return dispatch(AUTH_CHANGE_PASSWORD_FAIL({ error: errorMessage }));
}
diff --git a/src/state/actions/users.js b/src/state/actions/users.js
index 81fef3d6..0f45d0d4 100644
--- a/src/state/actions/users.js
+++ b/src/state/actions/users.js
@@ -86,6 +86,7 @@ const deleteLogo = oldLogo => {
export const deleteUser = id => {
return async (dispatch, getState) => {
dispatch(USERS_DELETE_USER_INIT());
+ const { locale } = getState().preferences;
const { logoUrl } = getState()
.users.data.filter(user => user.id === id)
.pop();
@@ -100,7 +101,7 @@ export const deleteUser = id => {
try {
await Promise.all([deleteLogoTask, deleteUserTask]);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
toastr.error('', errorMessage);
return dispatch(
USERS_DELETE_USER_FAIL({
@@ -146,8 +147,9 @@ export const createUser = ({
createdAt,
isAdmin
}) => {
- return async dispatch => {
+ return async (dispatch, getState) => {
dispatch(USERS_CREATE_USER_INIT());
+ const { locale } = getState().preferences;
const user = firebase.auth().currentUser;
@@ -157,7 +159,10 @@ export const createUser = ({
try {
response = await axios(userToken).post('/users', { email, isAdmin });
} catch (error) {
- const errorMessage = firebaseError(error.response.data.error.code);
+ const errorMessage = firebaseError(
+ error.response.data.error.code,
+ locale
+ );
toastr.error('', errorMessage);
return dispatch(
USERS_CREATE_USER_FAIL({
@@ -196,7 +201,7 @@ export const createUser = ({
sendSignInLinkToEmailTask
]);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
toastr.error('', errorMessage);
return dispatch(
USERS_CREATE_USER_FAIL({
@@ -222,6 +227,7 @@ export const modifyUser = ({
}) => {
return async (dispatch, getState) => {
dispatch(USERS_MODIFY_USER_INIT());
+ const { locale } = getState().preferences;
const { logoUrl } = getState()
.users.data.filter(user => user.id === id)
.pop();
@@ -230,7 +236,7 @@ export const modifyUser = ({
let newLogoUrl = null;
if (file) {
newLogoUrl = getLogoUrl(id, file);
- deleteLogoTask = logoUrl ? deleteLogo(logoUrl) : null;
+ deleteLogoTask = logoUrl && deleteLogo(logoUrl);
uploadLogoTask = uploadLogo(id, file);
}
@@ -250,7 +256,7 @@ export const modifyUser = ({
try {
await Promise.all([deleteLogoTask, uploadLogoTask, updateUserDbTask]);
} catch (error) {
- const errorMessage = firebaseError(error.code);
+ const errorMessage = firebaseError(error.code, locale);
toastr.error('', errorMessage);
return dispatch(
USERS_MODIFY_USER_FAIL({
diff --git a/src/utils/index.js b/src/utils/index.js
index 66571067..dbe6f24e 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,3 +1,5 @@
+import { createIntl, createIntlCache } from 'react-intl';
+
import english from 'languages/en';
import spanish from 'languages/es';
import en from 'assets/en.png';
@@ -17,52 +19,28 @@ export const FIREBASE_RESPONSE = {
UNAUTHORIZED_STORAGE: 'storage/unauthorized'
};
-export const firebaseError = error => {
- let errorMessage = '';
-
- switch (error) {
- case FIREBASE_RESPONSE.EMAIL_IN_USE:
- errorMessage = 'Email already in use';
- break;
- case FIREBASE_RESPONSE.EMAIL_INVALID:
- errorMessage = 'Email is invalid';
- break;
- case FIREBASE_RESPONSE.EMAIL_NOT_FOUND:
- errorMessage = 'Invalid credentials';
- break;
- case FIREBASE_RESPONSE.PASSWORD_INVALID:
- errorMessage = 'Invalid credentials';
- break;
- case FIREBASE_RESPONSE.USER_DISABLED:
- errorMessage = 'User disabled';
- break;
- case FIREBASE_RESPONSE.TOO_MANY_REQUESTS:
- errorMessage = 'Too many attempts made, try again later';
- break;
- case FIREBASE_RESPONSE.EXPIRED_ACTION_CODE:
- errorMessage =
- 'The invitation link has expired, get in touch with your administrator';
- break;
- case FIREBASE_RESPONSE.INVALID_ACTION_CODE:
- errorMessage =
- 'The invitation link has expired, get in touch with your administrator';
- break;
- case FIREBASE_RESPONSE.QUOTA_EXCEEDED_STORAGE:
- errorMessage =
- 'Internal server error, get in touch with your administrator';
- break;
- case FIREBASE_RESPONSE.UNAUTHENTICATED_STORAGE:
- errorMessage = 'Unauthenticated, please authenticate and try again.';
- break;
- case FIREBASE_RESPONSE.UNAUTHORIZED_STORAGE:
- errorMessage =
- 'Unauthoriez, you are not authorized to perform this action.';
- break;
- default:
- errorMessage = 'Unknown error, get in touch with your administrator';
- }
+export const messages = {
+ en: english,
+ es: spanish
+};
- return errorMessage;
+const getIntlContext = locale => {
+ const cache = createIntlCache();
+ return createIntl(
+ {
+ locale,
+ messages: messages[locale]
+ },
+ cache
+ );
+};
+
+export const firebaseError = (error, locale) => {
+ const intl = getIntlContext(locale);
+ return intl.formatMessage({
+ id: error,
+ defaultMessage: messages[locale]['utils.default']
+ });
};
export const validateEmail = email => {
@@ -72,7 +50,7 @@ export const validateEmail = email => {
);
};
-export const inputValidations = (email, password) => {
+export const inputValidations = (email, password, locale) => {
let inputs = {
email: {
modifier: null,
@@ -84,6 +62,7 @@ export const inputValidations = (email, password) => {
},
canSubmit: null
};
+ const intl = getIntlContext(locale);
const setInputs = (key, value) => {
inputs = { ...inputs, [`${key}`]: value };
@@ -94,7 +73,7 @@ export const inputValidations = (email, password) => {
if (email && !isValidEmail) {
setInputs('email', {
modifier: 'is-danger',
- message: 'Invalid email'
+ message: intl.formatMessage({ id: 'utils.invalidEmail' })
});
}
@@ -103,12 +82,12 @@ export const inputValidations = (email, password) => {
if (isValidPassword) {
setInputs('password', {
modifier: 'is-success',
- message: 'Safe password'
+ message: intl.formatMessage({ id: 'utils.safePassword' })
});
} else if (password) {
setInputs('password', {
modifier: 'is-danger',
- message: 'Unsafe password'
+ message: intl.formatMessage({ id: 'utils.unsafePassword' })
});
}
@@ -119,11 +98,6 @@ export const inputValidations = (email, password) => {
return inputs;
};
-export const messages = {
- en: english,
- es: spanish
-};
-
export const availableLocales = Object.keys(messages);
export const browserLocale = navigator.language.split(/[-_]/)[0];