From b72c33495a47a816c4259d68bc9feb5a23803df8 Mon Sep 17 00:00:00 2001 From: Arthour Date: Fri, 11 Aug 2017 14:37:43 +0200 Subject: [PATCH] Update jsPasswordChecker.js Change naming of some "repitition" vars and funcs to "repetition" --- jsPasswordChecker.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jsPasswordChecker.js b/jsPasswordChecker.js index aeca9e6..d92013d 100644 --- a/jsPasswordChecker.js +++ b/jsPasswordChecker.js @@ -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; } } }