Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated_Trusted_mail_services #647

Merged
Merged
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
14 changes: 13 additions & 1 deletion auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const sign_in_btn = document.querySelector("#sign-in-btn");
const sign_up_btn = document.querySelector("#sign-up-btn");
const container = document.querySelector(".container");

// Allowed email domains for registration
const allowedDomains = ['gmail.com', 'outlook.com', 'yahoo.com', 'hotmail.com' , 'icloud.com' , 'protonmail.com' , 'tutanota.com']; // Add more as needed

sign_up_btn.addEventListener("click", () => {
container.classList.add("sign-up-mode");
});
Expand Down Expand Up @@ -42,6 +45,15 @@ document.querySelector(".sign-up-form").addEventListener('submit', function(even
return;
}

// Extract domain from email
const emailDomain = email.split('@')[1];

// Check if email domain is allowed
if (!allowedDomains.includes(emailDomain)) {
alert('Please use an email from a reputable provider (Gmail, Outlook, Yahoo, etc.)');
return; // Prevent registration
}

// Dummy signup logic for demo purposes
localStorage.setItem('username', username);
localStorage.setItem('email', email);
Expand Down Expand Up @@ -91,4 +103,4 @@ function checkPasswordStrength() {
}

// Call the checkPasswordStrength function on password input
document.querySelector(".sign-up-form input[type='password']").addEventListener('input', checkPasswordStrength);
document.querySelector(".sign-up-form input[type='password']").addEventListener('input', checkPasswordStrength);
Loading