diff --git a/src/components/AuthPages/ForgetPwdResponse.jsx b/src/components/AuthPages/ForgetPwdResponse.jsx
index 10cc364..f17934f 100644
--- a/src/components/AuthPages/ForgetPwdResponse.jsx
+++ b/src/components/AuthPages/ForgetPwdResponse.jsx
@@ -1,6 +1,8 @@
import React from 'react'
+import { useNavigate } from 'react-router-dom'
const ForgetPwdResponse = ({title, message, type}) => {
+ const navigate = useNavigate()
return (
<>
diff --git a/src/components/AuthPages/ForgotPassword/index.jsx b/src/components/AuthPages/ForgotPassword/index.jsx
index d336a16..199e8c9 100644
--- a/src/components/AuthPages/ForgotPassword/index.jsx
+++ b/src/components/AuthPages/ForgotPassword/index.jsx
@@ -154,20 +154,6 @@ export default function ForgotPassword() {
{msgError}
)}
- {/* {msgSuccess && (
-
- If we find your email, you will receive a link to reset your
- password. Please use or{" "}
-
- contact form
- {" "}
- if you did not get our message after few minutes.
-
- )} */}
-
:
diff --git a/src/components/AuthPages/VerifyPassword/index.jsx b/src/components/AuthPages/VerifyPassword/index.jsx
index 4aeca4c..37fc6e6 100644
--- a/src/components/AuthPages/VerifyPassword/index.jsx
+++ b/src/components/AuthPages/VerifyPassword/index.jsx
@@ -6,10 +6,12 @@ import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout";
import ForgetPwdResponse from "../ForgetPwdResponse";
import PasswordValidator from "../../../lib/PasswordValidator";
+import LoadingSpinner from "../../Spinners/LoadingSpinner";
const VerifyPassword = () => {
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
+ const [requestStatus, setRequestStatus] = useState({loading: true, status:false, data: []})
const [msgError, setMsgError] = useState("");
const [linkLoader, setLinkLoader] = useState(false);
const [linkSuccess, setLinkSuccess] = useState(null);
@@ -63,24 +65,21 @@ const VerifyPassword = () => {
sessionid: "DUMMY-CANNOT_BE_EMPTY",
reset_link: token,
newpass: password,
+ m_uid: requestStatus.data?.m_uid || '',
+ reset_uid: requestStatus.data?.reset_uid || '',
step: 300,
action: 730,
};
const res = await userApi?.CompleteResetPassword(reqData);
- if (res.status === 200) {
+ if (res.status == 200) {
const { data } = res;
- console.log('RESPONSE', res)
-
- if (data?.status > 0 && data?.email) {
+ if (data?.internal_return >= 0) {
// setTimeout(() => {
// navigate("/login", { replace: true });
// setLinkLoader(false);
// }, 2000);
setLinkSuccess(true);
- } else if (data && data?.status == "Invalid Request") {
- setLinkLoader(false);
- setLinkSuccess(false);
} else {
setLinkLoader(false);
setMsgError("An error occurred");
@@ -101,11 +100,30 @@ const VerifyPassword = () => {
}
};
+ const verifyResetPwd = () => { // FUNCTION TO VERIFY RESET PASSWORD LINK
+ setRequestStatus({loading: true, status:false, data: []})
+ var reqData = {
+ sessionid: "DUMMY-CANNOT_BE_EMPTY",
+ reset_link: token,
+ step: 200,
+ action: 730,
+ };
+ userApi.CompleteResetPassword(reqData).then(res => {
+ if(res.status != 200 || res.data.internal_return < 0){
+ return setRequestStatus({loading: false, status:false, data: []})
+ }
+ setRequestStatus({loading: false, status:true, data: res.data})
+ }).catch(error => {
+ setRequestStatus({loading: false, status:false, data: []})
+ })
+ }
+
useEffect(()=>{
// little checker for the validity of the token
if (token==null || token?.length != 64) {
- setLinkSuccess(false);
+ return setRequestStatus({loading: false, status:false, data: []});
}
+ verifyResetPwd()
},[])
return (
<>
@@ -121,6 +139,10 @@ const VerifyPassword = () => {
+ {requestStatus.loading ?
+
+ :
+ !requestStatus.loading && requestStatus.status ?
{linkSuccess == null ?
<>
@@ -149,16 +171,22 @@ const VerifyPassword = () => {
>
:
}
+ :
+
+
+
+ }
@@ -234,25 +262,3 @@ const SuccessfulComponent = ({
);
-
-const ErrorComponent = ({ onClick }) => (
-