nl_tokens: Returns a value between - 1 and 100 to score the user s password .
pl_tokens: function calculateScore ( password ) { var score = 0 // password < options.minimumLength if ( password . length < options . minimumLength ) { return - 1 } // password length score += password . length * 4 score += checkRepetition ( 1 , password ) . length - password . length score += checkRepetition ( 2 , password ) . length - password . length score += checkRepetition ( 3 , password ) . length - password . length score += checkRepetition ( 4 , password ) . length - password . length // password has 3 numbers if ( password . match ( / (.*[0-9].*[0-9].*[0-9]) / ) ) { score += 5 } // password has at least 2 sybols var symbols = '.*[!,@,#,$,%,^,&,*,?,_,~]' symbols = new RegExp ( '(' + symbols + symbols + ')' ) if ( password . match ( symbols ) ) { score += 5 } // password has Upper and Lower chars if ( password . match ( / ([a-z].*[A-Z])|([A-Z].*[a-z]) / ) ) { score += 10 } // password has number and chars if ( password . match ( / ([a-zA-Z]) / ) && password . match ( / ([0-9]) / ) ) { score += 15 } // password has number and symbol if ( password . match ( / ([!,@,#,$,%,^,&,*,?,_,~]) / ) && password . match ( / ([0-9]) / ) ) { score += 15 } // password has char and symbol if ( password . match ( / ([!,@,#,$,%,^,&,*,?,_,~]) / ) && password . <mask> ( / ([a-zA-Z]) / ) ) { score += 15 } // password is just numbers or chars if ( password . match ( / ^\w+$ / ) || password . match ( / ^\d+$ / ) ) { score -= 10 } if ( score > 100 ) { score = 100 } if ( score < 0 ) { score = 0 } return score }