Password bugs solved
This commit is contained in:
parent
5735016d1c
commit
eb7226a6d7
@ -84,7 +84,7 @@ const ChangePassword = () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const failedRule = rules.find(r => !r.regex.test(password));
|
const failedRule = rules.find(r => !r.regex.test(password));
|
||||||
return failedRule ? `Password must contain: ${failedRule.msg}.` : "";
|
return failedRule ? `Password must meet complexity requirements.` : "";
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async (e) => {
|
const handleSubmit = async (e) => {
|
||||||
|
|||||||
@ -121,7 +121,7 @@ const PublicContactForm = () => {
|
|||||||
const response = await apiClient.post("/forgot-password/request-otp", payload);
|
const response = await apiClient.post("/forgot-password/request-otp", payload);
|
||||||
|
|
||||||
if (response?.data) {
|
if (response?.data) {
|
||||||
showToast('success', 'OTP sent to your registered email successfully!');
|
showToast('success', 'Verification Code sent to your registered email successfully!');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
navigate("/change-password", {
|
navigate("/change-password", {
|
||||||
state: { email: formData.email.trim() },
|
state: { email: formData.email.trim() },
|
||||||
@ -134,7 +134,7 @@ const PublicContactForm = () => {
|
|||||||
const msg =
|
const msg =
|
||||||
err.response?.data?.message ||
|
err.response?.data?.message ||
|
||||||
err.message ||
|
err.message ||
|
||||||
"Failed to send OTP. Please check your details and try again.";
|
"Failed to send Verification Code. Please check your details and try again.";
|
||||||
setErrorMsg(msg);
|
setErrorMsg(msg);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@ -161,7 +161,7 @@ const PublicContactForm = () => {
|
|||||||
const response = await apiClient.post("/forgot-password/verify-otp", payload);
|
const response = await apiClient.post("/forgot-password/verify-otp", payload);
|
||||||
|
|
||||||
if (response?.data?.status === "success") {
|
if (response?.data?.status === "success") {
|
||||||
setSuccess("OTP verified successfully. Redirecting to change password...");
|
setSuccess("Verification Code verified successfully. Redirecting to change password...");
|
||||||
setTimeout(() => navigate("/change-password"), 1500);
|
setTimeout(() => navigate("/change-password"), 1500);
|
||||||
} else {
|
} else {
|
||||||
const serverMsg = response?.data?.message?.toLowerCase() || "";
|
const serverMsg = response?.data?.message?.toLowerCase() || "";
|
||||||
@ -190,7 +190,7 @@ const PublicContactForm = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleResendOtp = () => {
|
const handleResendOtp = () => {
|
||||||
setOtpMsg("A new OTP has been sent to your registered email.");
|
setOtpMsg("A new Verification Code has been sent to your registered email.");
|
||||||
setOtp("");
|
setOtp("");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user