aodz

Password Strength monitor in flex

Posted by: vx on: October 10, 2008

Yesterday I spent hours writing my own password strength monitor utility in for a personal project but i couldn’t make it work properly, So i did exactly what every other developer does after getting thoroughly frustrated i.e.  I Googled until i reached this: geekWisdom ;)

  • Download source from here
  • Click on the image to view sample

You can even use a text input validator which would give you  the similar result. Depends on the requirement … one can make it as  fancy as  the one mentioned above or as simple as a validator

below is the code for textInput validation

package co.uk.BetaDesigns.utils.string
{
public class PasswordStrength{
private static var _strength : Number = 0;
private static var _regSmall : RegExp = new RegExp( /([a-z]+)/ );
private static var _regBig : RegExp = new RegExp( /([A-Z]+)/ );
private static var _regNum    : RegExp = new RegExp( /([0-9]+)/ );
private static var _regSpecial : RegExp = new RegExp( /(\W+)/ );

public static function checkStrength( password : String ) : Number{
_strength = 0;
if( password.search( _regSmall ) != -1 ){
_strength ++;
}
if( password.search( _regBig ) != -1 ){
_strength ++;
}
if( password.search( _regNum ) != -1 ){
_strength ++;
}
if( password.search( _regSpecial ) != -1 ){
_strength ++;
}
return _strength;
}
public function PasswordStrength( se : SingletonEnforcer ){
//Force it so the user can’t get here;
}
}
}
class SingletonEnforcer{}

1 Response to "Password Strength monitor in flex"

nice one

Leave a Reply

I have moved to a different location

check out my new home
Flexout

calendar

October 2008
M T W T F S S
« Sep   Dec »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blog Stat

  • 36,264 Hop's so far!!!

follow me

Archives

Linkedin Blogger Twitter Youtube Orkut

latest flickr photos

project 13_11

project 13_10

project 13_09

project 13_12

project 13_08

More Photos