在密码强度检查器中使用一系列不可用的单词
我是 jQuery 新手,目前正在修改 Firas Kassem 的密码强度计,并希望检查一系列不允许的单词。我遇到了 这个问题作为起点。我目前所拥有的是:
var badArr = ['password','system','user','demo','test','default'] //Array of unusable words
//check if bad words are in password
$.each(badArr, function(index,value)
{
if(password.match(value))
return badPass
})
问题是它不返回 badPass。对我做错了什么有任何见解吗?
I'm new to jQuery and am currently working on modifying Firas Kassem's password strength meter and wanted to check against an array of disallowed words. I came across this question for a starting point. What I have currently is:
var badArr = ['password','system','user','demo','test','default'] //Array of unusable words
//check if bad words are in password
$.each(badArr, function(index,value)
{
if(password.match(value))
return badPass
})
The problem is that it doesn't return the badPass. Any insight on what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,我已经建立了自己的力量计,因为我不需要力量计;只是一个需求检查器。
通过使用简单的password.match和正则表达式,我能够检查这些特定的单词。给我的要求没有指定大小写字母,所以我做了一个简单的匹配。
我还可以使用不同的算法检查以下内容。
一个有用的网站是 www.regular-expressions.info
I've actually built my own since I don't have the need for a strength meter; just a requirements checker.
By using a simple password.match using a regular expression, I was able to check for these certain words. The requirements that were given to me didn't specify upper or lower case letters, so I did a simple match.
I was also able to check for the below using different algorithms.
A helpful site was www.regular-expressions.info