diff --git a/src/languages/en.js b/src/languages/en.js index 560e7d692f25..5f7f9efbf2bf 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -319,6 +319,8 @@ export default { }, passwordForm: { pleaseFillOutAllFields: 'Please fill out all fields', + pleaseFillPassword: 'Please enter your password', + pleaseFillTwoFactorAuth: 'Please enter your two factor code', enterYourTwoFactorAuthenticationCodeToContinue: 'Enter your two factor authentication code to continue', forgot: 'Forgot?', twoFactorCode: 'Two factor code', diff --git a/src/languages/es.js b/src/languages/es.js index e7c6bedbe49f..e11d188e0662 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -319,6 +319,8 @@ export default { }, passwordForm: { pleaseFillOutAllFields: 'Por favor completa todos los campos', + pleaseFillPassword: 'Por favor, introduce tu contraseña', + pleaseFillTwoFactorAuth: 'Por favor, introduce tu código 2 factores', enterYourTwoFactorAuthenticationCodeToContinue: 'Ingrese su código de autenticación de dos factores para continuar', forgot: '¿Te has olvidado?', twoFactorCode: 'Autenticación de 2 factores', diff --git a/src/pages/signin/PasswordForm.js b/src/pages/signin/PasswordForm.js index e0341fc4cf06..ff2b4cd69950 100755 --- a/src/pages/signin/PasswordForm.js +++ b/src/pages/signin/PasswordForm.js @@ -56,13 +56,21 @@ class PasswordForm extends React.Component { * Check that all the form fields are valid, then trigger the submit callback */ validateAndSubmitForm() { - if (!this.state.password.trim() - || (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) - ) { + if (!this.state.password.trim() && this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) { this.setState({formError: 'passwordForm.pleaseFillOutAllFields'}); return; } + if (!this.state.password.trim()) { + this.setState({formError: 'passwordForm.pleaseFillPassword'}); + return; + } + + if (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) { + this.setState({formError: 'passwordForm.pleaseFillTwoFactorAuth'}); + return; + } + this.setState({ formError: null, });