From bfb67948f40433258c9dfffe62eb515de5bd7051 Mon Sep 17 00:00:00 2001 From: Anwishta Date: Sun, 6 Oct 2024 15:09:56 +0530 Subject: [PATCH 1/2] login logic added --- Html-files/login.html | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/Html-files/login.html b/Html-files/login.html index 56590949..d82d198d 100644 --- a/Html-files/login.html +++ b/Html-files/login.html @@ -128,20 +128,21 @@ -
+
@@ -211,6 +212,29 @@

LOGIN= 8; + + document.getElementById('error-message').textContent = ''; + + if (!emailPattern.test(emailInput)) { + document.getElementById('error-message').textContent = 'Invalid email format.'; + } else if (!isValidPassword) { + document.getElementById('error-message').textContent = 'Password must be at least 8 characters.'; + } else { + window.location.assign('logged.html'); + } +}); + \ No newline at end of file From 9397de067cdf9dfc6592a4834a48fc62e4553925 Mon Sep 17 00:00:00 2001 From: Anwishta Date: Sun, 6 Oct 2024 15:22:44 +0530 Subject: [PATCH 2/2] commands added --- Html-files/login.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Html-files/login.html b/Html-files/login.html index d82d198d..b204b547 100644 --- a/Html-files/login.html +++ b/Html-files/login.html @@ -213,24 +213,33 @@

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'); } });