From 712e436f584f4a7ba861fae0e8b00dfe16caee80 Mon Sep 17 00:00:00 2001 From: gaba Date: Fri, 6 Jan 2017 16:38:44 -0300 Subject: [PATCH] Cleans error on email address or name. We need to go through all the errors and manage them better with translations. --- client/coral-framework/actions/auth.js | 4 +++- client/coral-framework/translations.json | 6 ++++-- client/coral-sign-in/translations.js | 2 ++ models/user.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index 106224c25..f06ea7526 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -82,7 +82,9 @@ export const fetchSignUp = formData => (dispatch) => { dispatch(changeView('SIGNIN')); }, 3000); }) - .catch(() => dispatch(signUpFailure(lang.t('error.emailInUse')))); // We need to inprove error handling. TODO (bc) + .catch(() => { + dispatch(signUpFailure(lang.t('error.emailORusernameInUse'))); + }); // We need to improve error handling. TODO (bc) }; // Forgot Password Actions diff --git a/client/coral-framework/translations.json b/client/coral-framework/translations.json index 06a39944a..99d3341b1 100644 --- a/client/coral-framework/translations.json +++ b/client/coral-framework/translations.json @@ -10,7 +10,8 @@ "displayName": "Display name is too short", "confirmPassword": "Passwords don`t match. Please, check again", "emailPasswordError": "Email and/or password combination incorrect.", - "emailInUse": "Email address already in use" + "emailInUse": "Email address already in use", + "emailORusernameInUse": "Email address or Username already in use" } }, "es": { @@ -24,7 +25,8 @@ "displayName": "El nombre es muy corto", "confirmPassword": "Las contraseñas no coinciden", "emailPasswordError": "Email y/o contraseña incorrecta.", - "emailInUse": "Email address already in use" + "emailInUse": "Correo electronico en uso.", + "emailORusernameInUse": "Correo o Nombre en uso." } } } diff --git a/client/coral-sign-in/translations.js b/client/coral-sign-in/translations.js index 200cb91f1..a50ad6f54 100644 --- a/client/coral-sign-in/translations.js +++ b/client/coral-sign-in/translations.js @@ -19,6 +19,7 @@ export default { alreadyHaveAnAccount: 'Already have an account?', recoverPassword: 'Recover password', emailInUse: 'Email address already in use', + emailORusernameInUse: 'Email address or Username already in use', requiredField: 'This field is required', passwordsDontMatch: 'Passwords don\'t match.', checkTheForm: 'Invalid Form. Please, check the fields' @@ -44,6 +45,7 @@ export default { alreadyHaveAnAccount: 'Ya tienes una cuenta?', recoverPassword: 'Recuperar contraseña', emailInUse: 'Este email se encuentra en uso', + emailORusernameInUse: 'Este email ó nombre se encuentran en uso', requiredField: 'Este campo es requerido', passwordsDontMatch: 'Las contraseñas no coinciden', checkTheForm: 'Formulario Inválido. Por favor, completa los campos' diff --git a/models/user.js b/models/user.js index d8a116ae5..bcc22d895 100644 --- a/models/user.js +++ b/models/user.js @@ -356,7 +356,7 @@ UserService.createLocalUser = (email, password, displayName) => { user.save((err) => { if (err) { if (err.code === 11000) { - return reject('Email address already in use'); + return reject(new Error('Email address or Name already in use')); } return reject(err); }