From 0077cb99704fe863cf731fc5cab792af2ede96c2 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 17 Apr 2011 20:13:07 -0400 Subject: Backporting retarded amount of changes outside of version control --- admin/scripts/mocha.js | 312 ++++++++++++++++++++++++------------------------- 1 file changed, 156 insertions(+), 156 deletions(-) (limited to 'admin/scripts/mocha.js') diff --git a/admin/scripts/mocha.js b/admin/scripts/mocha.js index a220424..2e250c2 100644 --- a/admin/scripts/mocha.js +++ b/admin/scripts/mocha.js @@ -1,156 +1,156 @@ -/* - * -------------------------------------------------------------------- - * Simple Password Strength Checker - * by Siddharth S, www.ssiddharth.com, hello@ssiddharth.com - * for Net Tuts, www.net.tutsplus.com - * Version: 1.0, 05.10.2009 - * -------------------------------------------------------------------- - */ - - -$(document).ready(function() -{ - var strPassword; - var charPassword; - var complexity = $("#complexity"); - var rating = $("#rating") - var minPasswordLength = 6; - var baseScore = 0, score = 0; - - var num = {}; - num.Excess = 0; - num.Upper = 0; - num.Numbers = 0; - num.Symbols = 0; - - var bonus = {}; - bonus.Excess = 3; - bonus.Upper = 4; - bonus.Numbers = 5; - bonus.Symbols = 5; - bonus.Combo = 0; - bonus.FlatLower = 0; - bonus.FlatNumber = 0; - - outputResult(); - $("#inputPassword").bind("keyup", checkVal); - -function checkVal() -{ - init(); - - if (charPassword.length >= minPasswordLength) - { - baseScore = 50; - analyzeString(); - calcComplexity(); - } - else - { - baseScore = 0; - } - - outputResult(); -} - -function init() -{ - strPassword= $("#inputPassword").val(); - charPassword = strPassword.split(""); - - num.Excess = 0; - num.Upper = 0; - num.Numbers = 0; - num.Symbols = 0; - bonus.Combo = 0; - bonus.FlatLower = 0; - bonus.FlatNumber = 0; - baseScore = 0; - score =0; -} - -function analyzeString () -{ - for (i=0; i=50 && score<75) - { - complexity.html("Good"); - rating.removeClass("strong secure").addClass("good"); - } - else if (score>=75 && score<100) - { - complexity.html("Strong"); - rating.removeClass("secure").addClass("strong"); - } - else if (score>=100) - { - complexity.html("Secure"); - rating.addClass("secure"); - } - - /* - $("#details").html("Base Score :" + baseScore + "" - + "
Length Bonus :" + (num.Excess*bonus.Excess) + " ["+num.Excess+"x"+bonus.Excess+"] " - + "
Upper case bonus :" + (num.Upper*bonus.Upper) + " ["+num.Upper+"x"+bonus.Upper+"] " - + "
Number Bonus : " + (num.Numbers*bonus.Numbers) + " ["+num.Numbers+"x"+bonus.Numbers+"]" - + "
Symbol Bonus : " + (num.Symbols*bonus.Symbols) + " ["+num.Symbols+"x"+bonus.Symbols+"]" - + "
Combination Bonus : " + bonus.Combo + "" - + "
Lower case only penalty : " + bonus.FlatLower + "" - + "
Numbers only penalty : " + bonus.FlatNumber + "" - + "
Total Score: " + score + "" ); */ -} - -} -); +/* + * -------------------------------------------------------------------- + * Simple Password Strength Checker + * by Siddharth S, www.ssiddharth.com, hello@ssiddharth.com + * for Net Tuts, www.net.tutsplus.com + * Version: 1.0, 05.10.2009 + * -------------------------------------------------------------------- + */ + + +$(document).ready(function() +{ + var strPassword; + var charPassword; + var complexity = $("#complexity"); + var rating = $("#rating") + var minPasswordLength = 6; + var baseScore = 0, score = 0; + + var num = {}; + num.Excess = 0; + num.Upper = 0; + num.Numbers = 0; + num.Symbols = 0; + + var bonus = {}; + bonus.Excess = 3; + bonus.Upper = 4; + bonus.Numbers = 5; + bonus.Symbols = 5; + bonus.Combo = 0; + bonus.FlatLower = 0; + bonus.FlatNumber = 0; + + outputResult(); + $("#inputPassword").bind("keyup", checkVal); + +function checkVal() +{ + init(); + + if (charPassword.length >= minPasswordLength) + { + baseScore = 50; + analyzeString(); + calcComplexity(); + } + else + { + baseScore = 0; + } + + outputResult(); +} + +function init() +{ + strPassword= $("#inputPassword").val(); + charPassword = strPassword.split(""); + + num.Excess = 0; + num.Upper = 0; + num.Numbers = 0; + num.Symbols = 0; + bonus.Combo = 0; + bonus.FlatLower = 0; + bonus.FlatNumber = 0; + baseScore = 0; + score =0; +} + +function analyzeString () +{ + for (i=0; i=50 && score<75) + { + complexity.html("Good"); + rating.removeClass("strong secure").addClass("good"); + } + else if (score>=75 && score<100) + { + complexity.html("Strong"); + rating.removeClass("secure").addClass("strong"); + } + else if (score>=100) + { + complexity.html("Secure"); + rating.addClass("secure"); + } + + /* + $("#details").html("Base Score :" + baseScore + "" + + "
Length Bonus :" + (num.Excess*bonus.Excess) + " ["+num.Excess+"x"+bonus.Excess+"] " + + "
Upper case bonus :" + (num.Upper*bonus.Upper) + " ["+num.Upper+"x"+bonus.Upper+"] " + + "
Number Bonus : " + (num.Numbers*bonus.Numbers) + " ["+num.Numbers+"x"+bonus.Numbers+"]" + + "
Symbol Bonus : " + (num.Symbols*bonus.Symbols) + " ["+num.Symbols+"x"+bonus.Symbols+"]" + + "
Combination Bonus : " + bonus.Combo + "" + + "
Lower case only penalty : " + bonus.FlatLower + "" + + "
Numbers only penalty : " + bonus.FlatNumber + "" + + "
Total Score: " + score + "" ); */ +} + +} +); -- cgit