Skip to content

Commit

Permalink
Merge pull request #1071 from saras-69/nav
Browse files Browse the repository at this point in the history
improve-navigation for forgot password
  • Loading branch information
vivekvardhan2810 authored Oct 27, 2024
2 parents 88f5058 + f101222 commit 49523a9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion script/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ document.addEventListener("DOMContentLoaded", function () {
const toggleLoginPassword = document.getElementById('toggleLoginPassword');
const loginPassword = document.getElementById('loginPassword');
const loginIcon = document.getElementById('loginIcon');
const forgotPasswordLink = document.getElementById('forgotPasswordLink');

// Reattach toggle password visibility event listener
toggleLoginPassword.addEventListener('click', function () {
Expand All @@ -90,9 +91,13 @@ document.addEventListener("DOMContentLoaded", function () {
loginIcon.classList.add('fa-eye-slash');
}
});
forgotPasswordLink.addEventListener('click', function (event) {
event.preventDefault();
showForgotPasswordForm();
});

// Re-attach login form submission event listener
loginForm.addEventListener("submit", function(event) {
loginForm.addEventListener("submit", function (event) {
event.preventDefault();
validateForm("login");
});
Expand Down Expand Up @@ -235,4 +240,14 @@ document.addEventListener("DOMContentLoaded", function () {
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/;
return passwordRegex.test(password);
}
window.addEventListener('pageshow', (event) => {
if (event.persisted) {
restoreLoginForm();
}
}); window.addEventListener('pageshow', (event) => {
if (event.persisted) {
restoreLoginForm();
}
});

});

0 comments on commit 49523a9

Please sign in to comment.