diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 653c2bb..b3f86d4 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -42,7 +42,7 @@ function App() { } /> } /> - }> + }> }> } /> diff --git a/frontend/src/components/Auth/PasswordResetForm.tsx b/frontend/src/components/Auth/PasswordResetForm.tsx index 9931abc..a1dab67 100644 --- a/frontend/src/components/Auth/PasswordResetForm.tsx +++ b/frontend/src/components/Auth/PasswordResetForm.tsx @@ -48,7 +48,9 @@ const PasswordResetForm: React.FC = ({ onSubmit, token }) => { newErrors[key as keyof ResetPasswordErrors] = "Confirm your password"; } }); - + if (resetData.newPassword.length < 8) { + newErrors.newPasswordError = "Password must be at least 8 characters long"; + } if (resetData.newPassword !== resetData.confirmNewPassword) { newErrors.confirmNewPasswordError = "Passwords do not match"; } @@ -64,7 +66,7 @@ const PasswordResetForm: React.FC = ({ onSubmit, token }) => { if (validateResetForm()) { try { - const response = await fetch("/user/reset_password/ = ({ onSubmit, token }) => { if (!response.ok) { const data = await response.json(); throw new Error(data.message || "An error has occurred while resetting"); + } else { + confirmPasswordReset(); } } catch (error: any) { console.error("Password reset error:", error.message); @@ -84,7 +88,6 @@ const PasswordResetForm: React.FC = ({ onSubmit, token }) => { general: error.message || "An unexpected error occurred.", })); - confirmPasswordReset(); } } };