I am working with passwords now and want to make user to create complicated password. I use jQuery to check if password is long enough and how strong it is depending on used characters. Still, cant figure out how to make user to create password with no duplicated chars, so he cant make password like '111111111111111111111111' or '1qAz1qAz1qAz' etc. My code is here:
$("#new_pass").keyup(function() {
var newpass = $(this).val();
var chars = 0;
if((/[a-z]/).test(newpass)) chars += 26;
if((/[A-Z]/).test(newpass)) chars += 26;
if((/[0-9]/).test(newpass)) chars += 10;
if((/[^a-zA-Z0-9]/).test(newpass)) chars += 32;
var strength = Math.pow(chars, newpass.length)
alert(strength)
}
Thanks in advance.