Skip to content

Commit

Permalink
Merge pull request #8876 from thesahindia/thesahindia/password-valida…
Browse files Browse the repository at this point in the history
…tion

validate password complexity in the front end
  • Loading branch information
AndrewGable authored May 12, 2022
2 parents 6afed2a + 5151ad9 commit 83c4d3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize
import compose from '../../libs/compose';
import TextInput from '../../components/TextInput';
import * as ComponentUtils from '../../libs/ComponentUtils';
import * as ValidationUtils from '../../libs/ValidationUtils';
import withToggleVisibilityView, {toggleVisibilityViewPropTypes} from '../../components/withToggleVisibilityView';
import canFocusInputOnScreenFocus from '../../libs/canFocusInputOnScreenFocus';

Expand Down Expand Up @@ -103,6 +104,11 @@ class PasswordForm extends React.Component {
return;
}

if (!ValidationUtils.isValidPassword(this.state.password)) {
this.setState({formError: 'passwordForm.error.incorrectLoginOrPassword'});
return;
}

if (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim()) {
this.setState({formError: 'passwordForm.pleaseFillTwoFactorAuth'});
return;
Expand Down

0 comments on commit 83c4d3e

Please sign in to comment.