From fd9d0e938377bbd88c5df65f02fd021ef5520e15 Mon Sep 17 00:00:00 2001 From: adityamanapure <137915305+adityamanapure@users.noreply.github.com> Date: Sun, 27 Oct 2024 12:36:06 +0530 Subject: [PATCH 1/2] Update signup.html added password constraints --- Html-files/signup.html | 47 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/Html-files/signup.html b/Html-files/signup.html index 17e83eda..8a97bc0e 100644 --- a/Html-files/signup.html +++ b/Html-files/signup.html @@ -346,18 +346,47 @@

SIGN U defer> + }); + + // Function to validate password constraints + function validatePassword() { + const password = passwordField.value; + const minLength = 8; + const hasNumber = /\d/; + const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/; + + let message = ''; + + if (password.length < minLength) { + message += `Password must be at least ${minLength} characters long. `; + } + if (!hasNumber.test(password)) { + message += 'Password must contain at least one number. '; + } + if (!hasSpecialChar.test(password)) { + message += 'Password must contain at least one special character. '; + } + + passwordMessage.textContent = message; + } + + // Add event listener to password field + passwordField.addEventListener('input', validatePassword); + + + +
From 189876d583aec321e66d42a6f12f7ac6ffe06ee5 Mon Sep 17 00:00:00 2001 From: adityamanapure <137915305+adityamanapure@users.noreply.github.com> Date: Sun, 27 Oct 2024 12:41:43 +0530 Subject: [PATCH 2/2] Update login.html added success message on login --- Html-files/login.html | 74 +++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/Html-files/login.html b/Html-files/login.html index fa220990..268dee1e 100644 --- a/Html-files/login.html +++ b/Html-files/login.html @@ -387,36 +387,7 @@

LOGIN= 8; - - // Clear previous error message - document.getElementById('error-message').textContent = ''; - - // Validate the email and password separately - if (!emailPattern.test(emailInput)) { - // Display an error message if the email format is incorrect - document.getElementById('error-message').textContent = 'Invalid email format.'; - } else if (!isValidPassword) { - // Display an error message if the password is too short - document.getElementById('error-message').textContent = 'Password must be at least 8 characters.'; - } else { - // If both are valid, redirect to logged.html - window.location.assign('logged.html'); - } - }); + // Toggle password visibility function togglePasswordVisibility() { @@ -433,6 +404,47 @@

LOGIN + +
+ + - \ No newline at end of file +