1

Using Jquery I want to check

How can i check to see if password contains dictionary words,place names, sports teams,human names, etc using Jquery.

I can check if password contains: capital letter

//validate capital letter
if (pswd.match(/[A-Z]/)) {
    $('#capital').removeClass('invalid').addClass('valid');
    $("#btnLogin").prop("disabled", false);

} else {
    $('#capital').removeClass('valid').addClass('invalid');
    $("#btnLogin").prop("disabled", true);
}
Safi
  • 55
  • 8
  • Possible duplicate of [How can I check if one string contains another substring?](http://stackoverflow.com/questions/1789945/how-can-i-check-if-one-string-contains-another-substring) – krlzlx Mar 16 '16 at 13:15
  • You asked the exact same [question](http://stackoverflow.com/questions/36015153/check-if-the-password-contains-dictionary-words) except the title 22 hours ago... – krlzlx Mar 16 '16 at 13:17

1 Answers1

0

To do this you need some server-side service with http-access. Then use jquery to send ajax-request to this service. Your service should compare password with your dictionary of words, names etc. I don't think it worth it.

So, I can suggest you to just check password for some pattern that require using letters, digits, special chars.

And even better solution is to use existing components with beautiful visualization of password strength.

Dzianis Yafimau
  • 2,034
  • 1
  • 27
  • 38
  • many thanks for your response, i have already added the below validations: (1. At least one letter, 2. At least one capital letter, 3. At least one number 4. Be at least 10 characters 5.At least one special character.) – Safi Mar 18 '16 at 08:14