I have a function in JavaScript that increases the password strength bar. Currently, it only refers to the length of the strings, and I want it to increase more if it has unique characters and a combination of upper and lower case characters. Below is the current function that works.
var bar = $('#progressbar div');
var password1 = $("#txtNewPassword");
var len = password1.val().length;
bar.css('width', len * 10 + '%');
if (len * 10 < 50)
{
bar.css('background', 'red');
}
else if(len * 10 > 50 && len * 10 < 100)
{
bar.css('background', 'orange');
}
else if (len * 10 >= 100)
{
bar.css('background', 'green');
$('#submitPC').removeAttr('disabled');
}
I also have a submit button that is on and off when there is enough power. I want it to be the same as it is now, but with new additions. below is the add and remove attribute.
if (len * 10 < 100 || password != confirmPassword)
{
$('#submitPC').attr('disabled', 'disabled');
}
else
{
$('#submitPC').removeAttr('disabled');
}
I suggested that I would use the variable set in each conditional expression, which would allow us to obey the dependence on strength, and not just that length.
if (blnStrength = true && password != confirmPassword)
{
$('#submitPC').attr('disabled', 'disabled');
}
else
{
$('#submitPC').removeAttr('disabled');
}
, 100%, 1 .
1234567890 abcdefghij , . , .
at least 1 number Ucase or Lcase
Kieran12345 - K13r4NVen1s0N