diff --git a/frontend/src/components/auth/ForgotPassword.jsx b/frontend/src/components/auth/ForgotPassword.jsx
index 26364fe..a8e09a4 100644
--- a/frontend/src/components/auth/ForgotPassword.jsx
+++ b/frontend/src/components/auth/ForgotPassword.jsx
@@ -15,7 +15,10 @@ export default function ForgotPassword() {
const navigate = useNavigate();
- const isPasswordValid = newPassword.length >= 6;
+ const passwordRegex =
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/;
+
+ const isPasswordValid = passwordRegex.test(newPassword);
const isOtpValid = otp.trim().length === 6;
const doPasswordsMatch =
@@ -80,7 +83,9 @@ export default function ForgotPassword() {
}
if (!isPasswordValid) {
- setError("Password must be at least 6 characters");
+ setError(
+ "Password must be at least 8 characters long and include an uppercase letter, lowercase letter, number, and special character."
+ );
return;
}
@@ -253,7 +258,7 @@ export default function ForgotPassword() {
0 && !isPasswordValid}
value={newPassword}
id="new-password"
@@ -268,12 +273,21 @@ export default function ForgotPassword() {
role="alert"
className="text-xs font-black uppercase tracking-widest text-red-600"
>
- Password must be at least 6 characters
+ Password must be at least 8 characters and contain uppercase,
+ lowercase, number, and special character