Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,16 @@ <h3 style="font-size:12px; font-weight:700; text-transform:uppercase; color:var(
document.getElementById('auth-error').style.display = 'none';
});

// Password validation function
// Email validation function
function validateEmail(email) {

// format of email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

return emailRegex.test(email);
}

// Password validation function
function validatePassword(password) {

// Minimum 8 characters
Expand Down Expand Up @@ -358,6 +367,13 @@ <h3 style="font-size:12px; font-weight:700; text-transform:uppercase; color:var(
return;
}

// Email format validation
if (!validateEmail(email)) {
errorEl.textContent = 'Please enter a valid email address.';
errorEl.style.display = 'block';
return;
}

// Password validation check
if (!validatePassword(password)) {
errorEl.textContent =
Expand Down