1

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?

Community
  • 1
  • 1
Ian
  • 738
  • 5
  • 13
  • As a side note, I really hate it when sites/games implement this password strength checker thing, if I don't consider my account to your site worth more than a 3 character password, that's my choice. You could spend the time implementing this to improve your site instead so I find it more worth it. – Blindy May 16 '11 at 16:14
  • I agree Blindy, but this is a reference on the intranet to help my employees get into the habit of using stronger passwords. – Ian May 16 '11 at 16:26

1 Answers1

0

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.

 password.match(/((SYSTEM)|(Password)|(Default)|(USER)|(Demo)|(TEST))/)

I was also able to check for the below using different algorithms.

 //password != user name, first name, or last name
 //password != 6 chars, 6 nums, or 6 symbols
 //password != social security numbers
 //password != a date
 //password = 3 of 4 requirements (upper, lower, num, char)

A helpful site was www.regular-expressions.info

Ian
  • 738
  • 5
  • 13