Write the reason you're deleting this FAQ
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,
<html>
<head>
<script language="javascript">
function passwordStrength(pwd){
var msg = "Your Password is too weak!";
var pwdPoint = pwd.length;
var pwdIndicator = document.getElementById('pwdIndicator');
var lowerCaseCheck = new RegExp("[a-z]"); //checking for existence of lower case letter
var upperCaseCheck = new RegExp("[A-Z]"); //checking for existence of upper case letter
var numberExistenceCheck = new RegExp("[0-9]"); //checking for existence of number
var symbolExistenceCheck = new RegExp("\\W"); //checking for existence of symbol
if(pwdPoint > 7)
{
pwdPoint = 0;
if(lowerCaseCheck.test(pwd)) { pwdPoint += 4; }
if(upperCaseCheck.test(pwd)) { pwdPoint += 4; }
if(numberExistenceCheck.test(pwd)) { pwdPoint += 4; }
if(symbolExistenceCheck.test(pwd)) { pwdPoint += 4; }
if(pwdPoint>=16) { msg = "Your Password is Strong!"; }
else if(pwdPoint>=12) { msg = "Your Password is Normal!"; }
else if(pwdPoint>=8) { msg = "Your Password is weak!"; }
else if(pwdPoint>=4) { msg = "Your Password is too weak!"; }
else { msg = "Your Password is too weak!"; }
}
pwdIndicator.innerHTML = msg ;
}
</script>
</head>
<body>
<input type="text" name="pwd" id="pwd" size="20" onkeyup="return passwordStrength(this.value);" />
<span id="pwdIndicator" name="pwdIndicator"><b>Password Check!</b></span>
</body>
</html>
Are you sure you want to delete this post?
Are you sure you want to delete this post?
Are you sure you want to delete this post?
Are you sure you want to delete this post?
Are you sure you want to delete this post?
Are you sure you want to delete this post?
Are you sure you want to delete this post?
tionna
Are you sure you want to delete this post?