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

show specific err msg on password form #4945

Merged
merged 2 commits into from
Sep 2, 2021
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: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
14 changes: 11 additions & 3 deletions src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
puneetlath marked this conversation as resolved.
Show resolved Hide resolved
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,
});
Expand Down