@@ -112,6 +114,8 @@ Start your
const container = document.getElementById("container");
const loginSuccessBanner = document.getElementById("loginSuccessBanner");
const registerSuccessBanner = document.getElementById("registerSuccessBanner");
+ const loginDeclineBanner = document.getElementById("loginDeclineBanner");
+ const registerDeclineBanner = document.getElementById("registerDeclineBanner");
registerButton.addEventListener("click", (event) => {
event.preventDefault();
@@ -155,10 +159,25 @@ Start your
alert('Name Or Password Cannot Contain <,>,", or /');
return;
}
+
+ if(localStorage.getItem("email")===email){
+ registerDeclineBanner.style.display = "block";
+ setTimeout(() => {
+ registerDeclineBanner.style.display = "none";
+ }, 6000);
+ }
+
+ localStorage.setItem("name", name)
+ localStorage.setItem("email", email)
+ localStorage.setItem("password", password)
+
// Show register success banner
registerSuccessBanner.style.display = "block";
setTimeout(() => {
registerSuccessBanner.style.display = "none";
+ document.getElementById("registerName").value = "";
+ document.getElementById("registerEmail").value = "";
+ document.getElementById("registerPassword").value = "";
}, 3000);
} else {
email = document.getElementById("loginEmail").value;
@@ -175,11 +194,23 @@ Start your
alert('Password cannot contain <,>,", or /');
return;
}
- // Show login success banner
- loginSuccessBanner.style.display = "block";
- setTimeout(() => {
- loginSuccessBanner.style.display = "none";
- }, 3000);
+ const email_check = localStorage.getItem("email")
+ const password_check = localStorage.getItem("password")
+
+ if (email_check === email && password_check=== password){
+ // Show login success banner
+ loginSuccessBanner.style.display = "block";
+ setTimeout(() => {
+ loginSuccessBanner.style.display = "none";
+ }, 3000);
+ document.getElementById("loginEmail").value = "";
+ document.getElementById("loginPassword").value = "";
+ }else{
+ loginDeclineBanner.style.display = "block";
+ setTimeout(() => {
+ loginDeclineBanner.style.display = "none";
+ }, 3000);
+ }
}
}