diff --git a/login/login.css b/login/login.css index 54c3cb24..42900493 100644 --- a/login/login.css +++ b/login/login.css @@ -369,6 +369,19 @@ input { z-index: 10000; } +/* Add styles for the success banners */ +.decline-banner { + display: none; + background-color: #cc0000; + color: white; + padding: 15px; + text-align: center; + position: fixed; + top: 0; + width: 100%; + z-index: 10000; +} + /* hover ibn social icons */ .social-container .fb:hover { color: white; diff --git a/newLogin.html b/newLogin.html index cc0bed60..4a5710d2 100644 --- a/newLogin.html +++ b/newLogin.html @@ -12,7 +12,9 @@
Logged in successfully
+
Logged in Blocked
credentials didn't match
Registered successfully
+
Registered Blocked
Same email address
@@ -112,6 +114,8 @@

Start your
journey now

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
journey now

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
journey now

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); + } } }