Merge pull request #11 from danieldupriest/CreateSignUpPage

Create sign up page with password confirmation
This commit is contained in:
sliang17 2019-01-13 22:06:08 -08:00 committed by GitHub
commit 117c43d52d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -8,4 +8,15 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Sign up</title>
</head>
<body>
<h1>Sign up page</h1>
<form id="signup">
User Name: <input type="text" id="userName" minlength="4" size="10" required="required"><br>
Password: <input type="password" id="password" minlength="4" size="10" required="required"><br>
Confirm Password: <input type="password" id="confirmPassword"><br>
<input type="submit" value="Submit" formaction="index.html">
<a class="nav-link" href="index.html">Return to main menu</a>
</form>
</body>
<script src="signupPage.js"></script>
</html>

View file

@ -0,0 +1,12 @@
const password = document.getElementById("password");
const confirm_password = document.getElementById("confirmPassword");
function validatePassword(){
if(password.value != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
}
else {
confirm_password.setCustomValidity('');
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;