Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3195 fix messages on password screen #3769

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CONST.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ export default {
forgot: 'Forgot?',
twoFactorCode: 'Two Factor Code',
requiredWhen2FAEnabled: 'Required when 2FA is enabled',
error: {
incorrectLoginOrPassword: 'Incorrect login or password. Please try again.',
twoFactorAuthenticationEnabled: 'You have 2FA enabled on this account. Please sign in using your email or phone number.',
invalidLoginOrPassword: 'Invalid login or password. Please try again or reset your password.',
unableToResetPassword: 'We were unable to change your password. This is likely due to an expired password reset link in an old password reset email. We have emailed you a new link so you can try again. Check your Inbox and your Spam folder; it should arrive in just a few minutes.',
noAccess: 'You do not have access to this application. Please add your GitHub username for access.',
accountLocked: 'Your account has been locked after too many unsuccessful attempts. Please try again after 1 hour.',
fallback: 'Something went wrong. Please try again later.',
},
},
loginForm: {
pleaseEnterEmailOrPhoneNumber: 'Please enter an email or phone number',
Expand Down Expand Up @@ -412,7 +421,7 @@ export default {
},
},
session: {
offlineMessage: 'Looks like you\'re not connected to internet. Can you check your connection and try again?',
offlineMessage: 'Looks like you\'re offline. Please check your connection and try again.',
},
workspace: {
common: {
Expand Down
11 changes: 10 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ export default {
forgot: '¿Te has olvidado?',
twoFactorCode: 'Autenticación de 2 factores',
requiredWhen2FAEnabled: 'Obligatorio cuando A2F está habilitado',
error: {
incorrectLoginOrPassword: 'Usuario o clave incorrectos. Por favor inténtalo de nuevo',
twoFactorAuthenticationEnabled: 'Tienes autenticación de 2 factores activada en esta cuenta. Por favor conéctate usando su email o número de teléfono',
invalidLoginOrPassword: 'Usuario o clave incorrectos. Por favor inténtalo de nuevo o resetea tu clave',
unableToResetPassword: 'No pudimos cambiar tu clave. Probablemente porque el enlace para resetear la clave ha expirado. Te hemos enviado un nuevo enlace. Chequea tu bandeja de entrada y tu carpeta de Spam',
noAccess: 'No tienes acceso a esta aplicación. Por favor agrega tu usuario de GitHub para acceder',
accountLocked: 'Tu cuenta ha sido bloqueada tras varios intentos fallidos. Por favor inténtalo otra vez dentro de 1 hora',
fallback: 'Ha ocurrido un error. Por favor inténtalo mas tarde',
},
},
loginForm: {
pleaseEnterEmailOrPhoneNumber: 'Por favor escribe un email o número de teléfono',
Expand Down Expand Up @@ -343,7 +352,7 @@ export default {
},
},
session: {
offlineMessage: 'Parece que no estás conectado a internet. Comprueba tu conexión e inténtalo de nuevo.',
offlineMessage: 'Parece que estás desconectado. Por favor chequea tu conexión e inténtalo otra vez',
},
workspace: {
common: {
Expand Down
18 changes: 7 additions & 11 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,19 @@ function Authenticate(parameters) {
if (response.jsonCode !== 200) {
switch (response.jsonCode) {
case 401:
throw new Error('Incorrect login or password. Please try again.');
throw new Error('passwordForm.error.incorrectLoginOrPassword');
case 402:
// eslint-disable-next-line max-len
throw new Error('You have 2FA enabled on this account. Please sign in using your email or phone number.');
throw new Error('passwordForm.error.twoFactorAuthenticationEnabled');
case 403:
throw new Error('Invalid login or password. Please try again or reset your password.');
throw new Error('passwordForm.error.invalidLoginOrPassword');
case 404:
// eslint-disable-next-line max-len
throw new Error('We were unable to change your password. This is likely due to an expired password reset link in an old password reset email. We have emailed you a new link so you can try again. Check your Inbox and your Spam folder; it should arrive in just a few minutes.');
throw new Error('passwordForm.error.unableToResetPassword');
case 405:
// eslint-disable-next-line max-len
throw new Error('You do not have access to this application. Please add your GitHub username for access.');
throw new Error('passwordForm.error.noAccess');
case 413:
// eslint-disable-next-line max-len
throw new Error('Your account has been locked after too many unsuccessful attempts. Please try again after 1 hour.');
throw new Error('passwordForm.error.accountLocked');
default:
throw new Error('Something went wrong. Please try again later.');
throw new Error('passwordForm.error.fallback');
}
}
return response;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import CONFIG from '../../CONFIG';
import PushNotification from '../Notification/PushNotification';
import Timing from './Timing';
import CONST from '../../CONST';
import {translate} from '../translate';
import {translateLocal} from '../translate';

let credentials = {};
Onyx.connect({
Expand Down Expand Up @@ -130,7 +130,7 @@ function fetchAccountDetails(login) {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: response.message});
})
.catch(() => {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: translate('', 'session.offlineMessage')});
Onyx.merge(ONYXKEYS.ACCOUNT, {error: translateLocal('session.offlineMessage')});
})
.finally(() => {
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false});
Expand Down Expand Up @@ -216,7 +216,7 @@ function signIn(password, twoFactorAuthCode) {
createTemporaryLogin(authToken, encryptedAuthToken, email);
})
.catch((error) => {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: error.message, loading: false});
Onyx.merge(ONYXKEYS.ACCOUNT, {error: translateLocal(error.message), loading: false});
});
}

Expand Down