ActionScript 3 AS3密码强度计
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3密码强度计相关的知识,希望对你有一定的参考价值。
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;
}
以上是关于ActionScript 3 AS3密码强度计的主要内容,如果未能解决你的问题,请参考以下文章
密码强度计[关闭]
密码强度计[关闭]
推特引导程序的jQuery密码强度计
密码强度计
ActionScript 3 AS3 SWFtrospection(as3swf)
ActionScript 3 AS3 TextField和StyleSheet示例(在ActionScript中创建)