From cf07aaea2245a9c30ccef34fd087f4c988dc8543 Mon Sep 17 00:00:00 2001 From: Senthamilselvi Date: Wed, 5 Nov 2025 10:43:31 +0530 Subject: [PATCH] login page again captcha updated --- ipi-survey-platform/src/App.jsx | 2 +- ipi-survey-platform/src/pages/Login/Login.jsx | 34 ++++++++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/ipi-survey-platform/src/App.jsx b/ipi-survey-platform/src/App.jsx index dba9215..22550aa 100644 --- a/ipi-survey-platform/src/App.jsx +++ b/ipi-survey-platform/src/App.jsx @@ -92,7 +92,7 @@ function App() { React.useEffect(() => { const TIMEOUT_MINUTES = 15; - const WARNING_MINUTES = 2; + const WARNING_MINUTES = 2; let timer; let warningTimer; diff --git a/ipi-survey-platform/src/pages/Login/Login.jsx b/ipi-survey-platform/src/pages/Login/Login.jsx index 13e82bd..5e76864 100644 --- a/ipi-survey-platform/src/pages/Login/Login.jsx +++ b/ipi-survey-platform/src/pages/Login/Login.jsx @@ -5,9 +5,10 @@ import { RefreshCw, AlertCircle, Clock } from "lucide-react"; const logoSrc = '/assets/images/FCSCLogo.svg'; -const MAX_FAILED_ATTEMPTS = 3; -const SHOW_CAPTCHA_AFTER = 2; -const LOCK_DURATION_MINUTES = 2; +const MAX_FAILED_ATTEMPTS = 3; +const SHOW_CAPTCHA_AFTER = 0; +const LOCK_DURATION_MINUTES = 2; + const Login = () => { const navigate = useNavigate(); const location = useLocation(); @@ -166,14 +167,12 @@ const Login = () => { valid = false; } - if (failedAttempts >= SHOW_CAPTCHA_AFTER) { - if (!userCaptcha.trim()) { - setCaptchaError('Please enter the CAPTCHA.'); - valid = false; - } else if (userCaptcha !== captcha) { - setCaptchaError('Invalid CAPTCHA. Try again or refresh for a new code.'); - valid = false; - } + if (!userCaptcha.trim()) { + setCaptchaError('Please enter the CAPTCHA.'); + valid = false; + } else if (userCaptcha !== captcha) { + setCaptchaError('Invalid CAPTCHA. Try again or refresh for a new code.'); + valid = false; } return valid; @@ -267,9 +266,7 @@ const Login = () => { localStorage.setItem('failed_attempts', attempts); setFailedAttempts(attempts); - if (attempts >= SHOW_CAPTCHA_AFTER) { - refreshCaptcha(); - } + refreshCaptcha(); if (attempts >= MAX_FAILED_ATTEMPTS) { const lockUntil = Date.now() + LOCK_DURATION_MINUTES * 60 * 1000; @@ -337,7 +334,7 @@ const Login = () => {
- {isLocked && remainingTime > 0 && ( + {isLocked && remainingTime > 0 && (
@@ -435,8 +432,7 @@ const Login = () => { {passwordError &&

{passwordError}

}
- {failedAttempts >= SHOW_CAPTCHA_AFTER && ( -
+
@@ -483,7 +479,7 @@ const Login = () => { /> {captchaError &&

{captchaError}

}
- )} +