|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/wordpress/wp-admin/js/ |
Upload File : |
// Password strength meter
function passwordStrength(password,username) {
var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, symbolSize = 0, natLog, score;
//password < 4
if (password.length < 4 ) { return shortPass };
//password == username
if (password.toLowerCase()==username.toLowerCase()) return badPass;
if (password.match(/[0-9]/)) symbolSize +=10;
if (password.match(/[a-z]/)) symbolSize +=26;
if (password.match(/[A-Z]/)) symbolSize +=26;
if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31;
natLog = Math.log( Math.pow(symbolSize,password.length) );
score = natLog / Math.LN2;
if (score < 40 ) return badPass
if (score < 56 ) return goodPass
return strongPass;
}