code formatting, checking for mismatched passwords

This commit is contained in:
slawk0
2024-08-20 13:32:40 +02:00
parent 5026e70129
commit 52e1201d59
2 changed files with 8 additions and 10 deletions

View File

@@ -10,13 +10,14 @@ function showPasswd() {
}
}
const password = document.getElementById("Password").trim();
const sPassword = document.getElementById("sPassword").trim();
document.getElementById('signupForm').addEventListener('submit',async function (event) {
event.preventDefault();
document.getElementById('signupForm').addEventListener('submit',function (event) {
const password = document.getElementById("password").value;
const sPassword = document.getElementById("sPassword").value;
console.log(password, sPassword);
if(password !== sPassword){
alert("Passwords don't match!");
event.preventDefault();
}
})

View File

@@ -14,16 +14,13 @@
<h1>Login</h1>
<form action="/auth/signup" method="post" id="signupForm">
<label for="username">
</label>
<label for="username"></label>
<input type="text" name="username" placeholder="Username" id="username" required>
<label for="password">
</label>
<label for="password"></label>
<input type="password" name="password" placeholder="Password" id="password" required>
<label for="sPassword">
</label>
<label for="sPassword"></label>
<input type="password" name="sPassword" placeholder="Confirm password" id="sPassword" required>
<input type="checkbox" onclick="showPasswd()">Show Passwords