1
我正在使用jQuery插件来评估密码强度。它为用户提供了一个图形表示,以查看密码的安全性。我想用它来验证该领域。jQuery密码强度插件回调验证方法
该插件的工作原理是评估密码并给出分数。我希望能够验证用户是否输入了至少一定分数的密码。代码托管在jQuery的网站上:http://plugins.jquery.com/project/pstrength。
该文档指出有一种方法可以添加规则并执行自定义验证。我不知道从哪里开始。内联文档指出:
* === Changelog ===
* Version 2.1 (18/05/2008)
* Added a jQuery method to add a new rule: jQuery('input[@type=password]').pstrength.addRule(name, method, score, active)
而在后面的代码有以下方法:
jQuery.extend(jQuery.fn.pstrength, {
'addRule': function (name, method, score, active) {
digitalspaghetti.password.addRule(name, method, score, active);
return true;
},
'changeScore': function (rule, score) {
digitalspaghetti.password.ruleScores[rule] = score;
return true;
},
'ruleActive': function (rule, active) {
digitalspaghetti.password.rules[rule] = active;
return true;
}
});
如果有人已经看到了如何做到这一点,我会很感激在正确的方向指针的例子。谢谢!
sbmaxx,谢谢你的帮助。这是我需要的。我微调了一下,让选择器正确,并适合我的应用程序,它运作良好。谢谢您的帮助。 – jmorhardt 2010-06-09 14:29:06