Password Verifier Imagine you are developing a software package that requires us
ID: 3843454 • Letter: P
Question
Password Verifier Imagine you are developing a software package that requires users to enter their own passwords. Your software requires that users' passwords meet the following criteria: The password should be at least six characters long. The password should contain at least one uppercase and at least one lowercase letter. The password should have at least one digit. Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn't, the program should display a message telling the user why.Explanation / Answer
HTML :-
<input id="pass" type="password"></input>
<input type="button" value="go!"></input>
javascript:-
PasswordChecker = function () {
var string = document.getElementById('pass').value;
if (string.length < 6) {
alert("Password enter is too short");
return ("Password enter is too short");
} else if (string.search(/d/) == -1) {
alert("Number required");
return ("Number required");
} else if (string.search(/[a-zA-Z]/) == -1) {
alert("Captial Letter required");
return ("Captial Letter required");
}
alert("Password Ok!");
return ("okay");
}
You will be validating if the password has Less than 6 characters or Passwowrd with no number or with out captial letter. You will be getting an alert box if it is not good.