This commit is contained in:
RochesterX
2025-11-28 13:54:57 -05:00
parent 881c057b6a
commit 711380db2a
11 changed files with 357 additions and 55 deletions

View File

@@ -2,10 +2,15 @@ import { postData } from "./client.js";
const registerForm = document.getElementById("registerForm");
const error = document.querySelector(".error");
const errorMessage = document.querySelector(".error p");
const success = document.querySelector(".success");
if (registerForm) registerForm.onsubmit = async e => {
e.preventDefault();
if (registerForm.regPass.value !== registerForm.regVerify.value) {
alert("Passwords must match");
error.style.display = "flex";
errorMessage.innerHTML = "Passwords must match";
return;
}
@@ -14,7 +19,13 @@ if (registerForm) registerForm.onsubmit = async e => {
password: registerForm.regPass.value,
role: registerForm.regRole.value
});
alert(resultObject.message);
if (resultObject.message.includes("success")) {
error.style.display = "none";
success.style.display = "flex";
} else {
errorMessage.innerHTML = resultObject.message;
error.style.display = "flex";
}
if (resultObject.success === true) {
window.location.href = "/login";
}