mirror of
https://github.com/sigmasternchen/jsPasswordChecker
synced 2025-03-16 00:08:55 +00:00
Update jsPasswordChecker.js
Change naming of some "repitition" vars and funcs to "repetition"
This commit is contained in:
parent
b5721f9b63
commit
b72c33495a
1 changed files with 6 additions and 6 deletions
|
@ -60,23 +60,23 @@ PasswordChecker.prototype.checkDictionary = function(password) {
|
|||
}
|
||||
|
||||
PasswordChecker.prototype.checkCharacterRepetition = function(password) {
|
||||
var repitition = this.policies.maxCharacterRepetition;
|
||||
var repetition = this.policies.maxCharacterRepetition;
|
||||
|
||||
if (password.length > 0 && repitition <= 1)
|
||||
if (password.length > 0 && repetition <= 1)
|
||||
return; // policies don't make any sense
|
||||
|
||||
var currentChar = password.charAt(0);
|
||||
var currentRepitition = 1;
|
||||
var currentRepetition = 1;
|
||||
|
||||
for (var i = 1; i < password.length; i++) {
|
||||
var tmp = password.charAt(i);
|
||||
if (tmp === currentChar) {
|
||||
currentRepitition++;
|
||||
if (currentRepitition > repitition)
|
||||
currentRepetition++;
|
||||
if (currentRepetition > repetition)
|
||||
throw "The password contains to many identical characters in a row.";
|
||||
} else {
|
||||
currentChar = tmp;
|
||||
currentRepitition = 1;
|
||||
currentRepetition = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue