diff --git a/SignUp/signup.js b/SignUp/signup.js index 95675265..a6a9ba95 100644 --- a/SignUp/signup.js +++ b/SignUp/signup.js @@ -13,6 +13,12 @@ document.addEventListener("DOMContentLoaded", () => { alert("Every field is required"); return; } + + const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; + if (!emailPattern.test(email)) { + alert("Please enter a valid email address."); + return; // Stop the function if the email is not in the right format + } const userdata = { name, diff --git a/login/login.html b/login/login.html index da164510..fa23aea0 100644 --- a/login/login.html +++ b/login/login.html @@ -83,6 +83,13 @@