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?
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 http://www.regular-expressions.info