Skip to content

Commit 175a1f2

Browse files
authored
Merge pull request #4945 from thesahindia/thesahindia/ui-ux/passwordForm
show specific err msg on password form
2 parents 3140b84 + c269587 commit 175a1f2

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/languages/en.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ export default {
319319
},
320320
passwordForm: {
321321
pleaseFillOutAllFields: 'Please fill out all fields',
322+
pleaseFillPassword: 'Please enter your password',
323+
pleaseFillTwoFactorAuth: 'Please enter your two factor code',
322324
enterYourTwoFactorAuthenticationCodeToContinue: 'Enter your two factor authentication code to continue',
323325
forgot: 'Forgot?',
324326
twoFactorCode: 'Two factor code',

src/languages/es.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ export default {
319319
},
320320
passwordForm: {
321321
pleaseFillOutAllFields: 'Por favor completa todos los campos',
322+
pleaseFillPassword: 'Por favor, introduce tu contraseña',
323+
pleaseFillTwoFactorAuth: 'Por favor, introduce tu código 2 factores',
322324
enterYourTwoFactorAuthenticationCodeToContinue: 'Ingrese su código de autenticación de dos factores para continuar',
323325
forgot: '¿Te has olvidado?',
324326
twoFactorCode: 'Autenticación de 2 factores',

src/pages/signin/PasswordForm.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,21 @@ class PasswordForm extends React.Component {
5656
* Check that all the form fields are valid, then trigger the submit callback
5757
*/
5858
validateAndSubmitForm() {
59-
if (!this.state.password.trim()
60-
|| (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim())
61-
) {
59+
if (!this.state.password.trim() && this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) {
6260
this.setState({formError: 'passwordForm.pleaseFillOutAllFields'});
6361
return;
6462
}
6563

64+
if (!this.state.password.trim()) {
65+
this.setState({formError: 'passwordForm.pleaseFillPassword'});
66+
return;
67+
}
68+
69+
if (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) {
70+
this.setState({formError: 'passwordForm.pleaseFillTwoFactorAuth'});
71+
return;
72+
}
73+
6674
this.setState({
6775
formError: null,
6876
});

0 commit comments

Comments
 (0)