diff --git a/Frontend/src/pages/Login/SignupPage.jsx b/Frontend/src/pages/Login/SignupPage.jsx index 60e1ac5..7d8113c 100644 --- a/Frontend/src/pages/Login/SignupPage.jsx +++ b/Frontend/src/pages/Login/SignupPage.jsx @@ -16,6 +16,7 @@ const SignupPage = (props) => { const [error, setError] = useState(""); const [passwordStrength, setPasswordStrength] = useState(""); + const [loading, setLoading] = useState(false); const navigate = useNavigate(); const evaluatePasswordStrength = (password) => { @@ -33,7 +34,7 @@ const SignupPage = (props) => { const handlePasswordChange = (e) => { const pwd = e.target.value; - passwordElement.current.value = pwd; // keep the ref synced + passwordElement.current.value = pwd; // sync with ref setPasswordStrength(evaluatePasswordStrength(pwd)); }; @@ -53,15 +54,18 @@ const SignupPage = (props) => { return; } + setLoading(true); try { const pwned = await isPasswordPwned(password); if (pwned) { setError("This password previously appeared in a data breach. Please use a new password."); + setLoading(false); return; } } catch (err) { console.error("Password breach check failed:", err); setError("Something went wrong while checking password security. Try again."); + setLoading(false); return; } @@ -96,6 +100,7 @@ const SignupPage = (props) => { emailElement.current.value = ""; passwordElement.current.value = ""; setPasswordStrength(""); + setLoading(false); }; return ( @@ -107,6 +112,7 @@ const SignupPage = (props) => {
{t("signup_welcome", language)}
{t("signup_subtitle", language)}
+