Skip to content

Commit

Permalink
Block password change depending on its strength (#5838)
Browse files Browse the repository at this point in the history
* Block password change depending on its strength

* revert as a simple UI customization
  • Loading branch information
leleuj authored Nov 8, 2023
1 parent 2242ac9 commit 964430e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ function jqueryReady() {

let passwordPolicyViolated = val === '' || !policyPatternRegex.test(val);
let passwordMismatch = val !== '' && val !== cnf;
let disableSubmit = passwordPolicyViolated || passwordMismatch;
let result = zxcvbn(val);
let passwordTooWeak = passwordMinimumStrength > result.score;
let disableSubmit = passwordPolicyViolated || passwordMismatch || passwordTooWeak;
$('#submit').prop('disabled', disableSubmit);

let result = zxcvbn(val);
$('#strengthProgressBar').zxcvbnProgressBar({ passwordInput: 'password', bar: bar });

// Check strength, update the text indicator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
3: /*[[#{screen.pm.password.strength.3}]]*/,
4: /*[[#{screen.pm.password.strength.4}]]*/
};
let passwordMinimumStrength = 0;

/*]]>*/

Expand Down

0 comments on commit 964430e

Please sign in to comment.