Skip to content

Commit

Permalink
validate password complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
thesahindia committed May 4, 2022
1 parent 3faa6a7 commit 5151ad9
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 @@ -101,6 +102,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 5151ad9

Please sign in to comment.