Tutorial How to Check Password Strength using Regular Expression

Discussion in 'Javascript' started by shek, Jul 16, 2013.

  1. shek

    shek Active Member

    In one of my earlier tutorial, How to Create Strong Passwords, I discussed about creating strong password. But that was one side of the coin! I mean, that tutorial was for internet users who wants to keep there account secure. But what is your responsibility as a webmaster? You have make sure that when user is registering your site you inform user about his/her password quality. You can provide dynamic feedback (as user types) to user on a webpage using javascript! In this tutorial, I'll share the javascript which you need to embed in your webpage.

    There are pros and cons of using javascript to test password strength. One of the most important pro of using javascript, is that, it will not overload your server with request for checking password strength. Another advantage you are saving user's time & bandwidth. As it will not allow user to submit form, until he/she has input string password. Disadvantage of using javascript is user can always disable javascript through browser settings, so the trick of using javascript might fail! You can overcome this problem by forcing user to enable javascript or do a re-check at server for password strength. It will also help you in doing double check of password strength.

    In this tutorial, we will be using regular expression to check password strength. Please look into f0llowing code,
    weakpassword_2.JPG
    Normal password.JPG
    string password.JPG Above code checks for password strength and show feedback on screen as user types. It does it with help of "onkeyup" attribute of input tag. You need to write another function which is called on submit button, were you check if password is strong or not using above mentioned function. If password isn't strong then you shouldn't allow user to submit form or based on your requirement you can lower the bar of security and customize above javascript code for a user to register. I'll comeback with new tutorial ASAP. So, stay tuned to SEOClerks! :)

    Attached Files:

  2. tionna

    tionna Active Member

    I have had issues with passwords in the past so I will take your advice here and learn from it.
  3. angie828

    angie828 Contributing Member

    Great job Shek. Nice work once again.
  4. seoboss

    seoboss Active Member

    thanks for this post
  5. evie

    evie Active Member

    Looks complicated in a way but thanks.
  6. ralph101

    ralph101 Junior Member

    Shek you are a tutorial God!
  7. loulou

    loulou Junior Member

    Wonderful job on this. Will have to check it out.
  8. twilight

    twilight Active Member

    Nice posting, will be sure to utilize this one.
  9. Miken34

    Miken34 Active Member

    Wonderful work on these. Will you be adding more posts soon?
  10. ultimate

    ultimate Active Member

    For passwords, I used to make new passwords and keep track of them manually until I me http://go.yoar.in/ZakdW
    It now feels like a breeze using this Google Chrome Extension.
  11. haleystar

    haleystar New Member

Share This Page