Merge branch 'main' of https://github.com/john-david3/cs3305-team11 into dev
This commit is contained in:
@@ -48,7 +48,9 @@ const PasswordResetForm: React.FC<SubmitProps> = ({ 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";
|
||||
}
|
||||
@@ -76,6 +78,8 @@ const PasswordResetForm: React.FC<SubmitProps> = ({ 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<SubmitProps> = ({ onSubmit, token }) => {
|
||||
general: error.message || "An unexpected error occurred.",
|
||||
|
||||
}));
|
||||
confirmPasswordReset();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user