To analyse the strength of a password we need to parse the contents of a textfield every time the contents change.
For the purposes of this tutorial we'll use the following thresholds:
Too Short - less than 4 characters Fair - less than 7 characters Medium - 7 or more characters (characters only, no numbers) Strong - 7 or more characters including at least 1 number
We have an image for each strength - you can use these or create your own:
The next thing to do is to load these four images into an array so they can be displayed as and when we need them - we simply create four Image objects and define the src attribute.
Then we need to check for at least one number - if it has a number it's strong, if it hasn't it's fair. We use the charAt() function to
loop through each of the characters and then use isNaN to find out if the current character is an integer.
These resources are provided free of charge. If, however, you would like to make a donation to help finance these resources, no matter how big or small, please use the PayPal
button below.
Credits
This resource was written by Tim Bennett Bsc (Hons). Tim Bennett has a First Class Degree in
Multimedia Systems Computing
from Leeds Metropolitan University. He works as a freelance multimedia developer under the company name
Texelate creating free and
commissioned
high-quality multimedia solutions. Find out more by visiting the portfolio section and viewing his blog. If
you'd like to request a resource get in touch!
Rate this Resource
Click on the appropriate star below to rate this resource:
Num votes: 831
Average: 4.3 / 10
Comments
It only checks the char number. So, it doesn't work much. It should check if the symbols are more like random or they form a word or something close.
Example: y7en89d41v and abcdefghij doesn't have the same password strength
That one commented on 24/12/2007, 14:38:39
Great work
VBS commented on 05/12/2007, 10:53:06
Aweseom thing man!
Anonymous commented on 21/11/2007, 13:19:24
this
is really
greate...and powerfully.... thankyou , really thank you...
Example: y7en89d41v and abcdefghij doesn't have the same password strength