Revision: 38783
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 7, 2011 19:22 by jaredyeo
Initial Code
static public function
fStart(
vUserName : String,
vInput : String
) : String
{
var vScore : int;
// var vHasLetters : Array = vInput.match(/[a-zA-Z]+/);
var vHasNumbers : Array = vInput.match(/[0-9]+/g);
var vHasPunctuation : Array = vInput.match(/[^a-zA-Z0-9]+/);
var vHasCasing : Array = vInput.match(/[a-z]+.*[A-Z]+|[A-Z]+.*[a-z]+/);
var vResult : String;
if (vInput.length == 0) return "It's blank!";
vScore += (vInput.length < 7 ? 0 : 1);
vScore += (vInput.length >= 12 ? 1 : 0);
vScore += (vInput.toLowerCase() == vUserName.toLowerCase() ? 0 : 1);
vScore += (vHasNumbers == null ? 0 : 1);
vScore += (vHasNumbers != null && vHasNumbers.length <= 4 ? 0 : 1);
vScore += (vHasPunctuation == null ? 0 : 1);
vScore += (vHasPunctuation != null && String(vHasPunctuation).length <= 2 ? 0 : 1);
vScore += (vHasCasing == null ? 0 : 1);
vScore += (vHasCasing != null && String(vHasCasing).length <= 2 ? 0 : 1);
switch (vScore)
{
case 0:
case 1:
case 2:
case 3:
vResult = "Weak";
break;
case 4:
case 5:
case 6:
case 7:
vResult = "Medium";
break;
case 8:
case 9:
vResult = "Strong";
break;
}
return vResult;
}
Initial URL
http://simplistika.com
Initial Description
Initial Title
AS3 Password Strength Meter
Initial Tags
Initial Language
ActionScript 3