From fbeff6d8c59fd5be4dffd105cedad43748ff26f2 Mon Sep 17 00:00:00 2001 From: Ebube Date: Wed, 3 May 2023 22:51:43 +0100 Subject: [PATCH] initial commit --- src/Routers.jsx | 3 +- .../AuthPages/VerifyPassword/index.jsx | 155 ++++++++++++++++++ src/components/AuthPages/VerifyYou/index.jsx | 51 +++--- src/services/UsersService.js | 4 + src/views/VerifyPasswordPages.jsx | 6 + 5 files changed, 198 insertions(+), 21 deletions(-) create mode 100644 src/components/AuthPages/VerifyPassword/index.jsx create mode 100644 src/views/VerifyPasswordPages.jsx diff --git a/src/Routers.jsx b/src/Routers.jsx index 79abf42..1e8ac9c 100644 --- a/src/Routers.jsx +++ b/src/Routers.jsx @@ -22,7 +22,7 @@ import UpdatePasswordPages from "./views/UpdatePasswordPages"; import UploadProductPage from "./views/UploadProductPage"; import UserProfilePage from "./views/UserProfilePage"; import VerifyYouPages from "./views/VerifyYouPages"; - +import VerifyPasswordPages from "./views/VerifyPasswordPages"; import RemindersPage from './views/RemindersPage'; import TrackingPage from "./views/TrackingPage"; import CalendarPage from "./views/CalendarPage"; @@ -50,6 +50,7 @@ export default function Routers() { element={} /> } /> + } /> } /> {/* private route */} diff --git a/src/components/AuthPages/VerifyPassword/index.jsx b/src/components/AuthPages/VerifyPassword/index.jsx new file mode 100644 index 0000000..42562d5 --- /dev/null +++ b/src/components/AuthPages/VerifyPassword/index.jsx @@ -0,0 +1,155 @@ +import { useState, useEffect, useCallback } from "react"; +import { useLocation, Link, useNavigate } from "react-router-dom"; +import AuthLayout from "../AuthLayout"; +import InputCom from "../../Helpers/Inputs/InputCom"; +import usersService from "../../../services/UsersService"; +import WrenchBoard from "../../../assets/images/wrenchboard.png"; + +const VerifyPassword = () => { + const [password, setPassword] = useState(""); + const [msgError, setMsgError] = useState(""); + const [linkLoader, setLinkLoader] = useState(false); + const [pageLoader, setPageLoader] = useState(true); + const [linkSuccess, setLinkSuccess] = useState(true); + const navigate = useNavigate(); + const location = useLocation(); + const queryParams = new URLSearchParams(location?.search); + const token = queryParams.get("complereset"); + const userApi = new usersService(); + + // Password + const handlePassword = (e) => { + setPassword(e.target.value); + }; + + const completeReset = async () => { + if (password === "") { + setMsgError("Please fill in fields"); + } + + try { + if(password != ""){ + setLinkLoader(true) + var reqData = { + sessionid: 'dummy', + reset_link: token, + newpass: password, + step: 300, + action: 730 + } + } + } catch (error) { + + } + } + + return ( + <> + + {pageLoader ? ( + wrenchboard + ) : ( +
+
+ + wrenchboard + +
+
+
+
+

+ {linkSuccess + ? "Sign In to WrenchBoard" + : "Invalid verification link"} +

+
+ {/* If the verification was a success */} + {linkSuccess ? ( + + ) : ( + navigate("/login")} /> + )} +
+
+
+ )} +
+ + ); +}; + +export default VerifyPassword; + +const SuccessfulComponent = ({ + onSubmit, + password, + handlePassword, + msgErr, + loader, +}) => ( +
+ {/* INPUT */} +
+ +
+ {msgErr && ( +
+ {msgErr} +
+ )} +
+ +
+
+); + +const ErrorComponent = ({ onClick }) => ( +
+
+

+ This error occurs because you have already verified this link or the + link has expired. Try login or reset password. If none worked, try to + create the account from the start. +

+
+ +
+ +
+
+); diff --git a/src/components/AuthPages/VerifyYou/index.jsx b/src/components/AuthPages/VerifyYou/index.jsx index c8d8831..3f3ddb6 100644 --- a/src/components/AuthPages/VerifyYou/index.jsx +++ b/src/components/AuthPages/VerifyYou/index.jsx @@ -1,18 +1,20 @@ import { useNavigate, Link } from "react-router-dom"; import AuthLayout from "../AuthLayout"; -import WrenchBoard from "../../../assets/images/wrenchboard.png" +import WrenchBoard from "../../../assets/images/wrenchboard.png"; export default function VerifyYou() { - const navigate = useNavigate() + const navigate = useNavigate(); return ( <> - +
-
- - wrenchboard +
+ + wrenchboard
@@ -21,29 +23,38 @@ export default function VerifyYou() {

Let's verify your email now

- Check your email. + + Check your email. +

- Verify Email. Help us secure your WrenchBoard account by verifying your email registration address. Verification will let you access all of WrenchBoard's features. + Verify Email. Help us secure your WrenchBoard account + by verifying your email registration address. Verification + will let you access all of WrenchBoard's features.

- If you do not receive the confirmation message within a few minutes of signing up, please check your Junk E-mail folder just in case the confirmation email got delivered there instead of your inbox. If so, select the confirmation message and click Not Junk, which will allow future messages to get through. + If you do not receive the confirmation message within a few + minutes of signing up, please check your Junk E-mail folder + just in case the confirmation email got delivered there + instead of your inbox. If so, select the confirmation + message and click Not Junk, which will allow future messages + to get through.

-
- -
+
+ +
diff --git a/src/services/UsersService.js b/src/services/UsersService.js index ebf00df..8262274 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -288,6 +288,10 @@ class usersService { return this.postAuxEnd("/startresetpasword", reqData) } + CompleteResetPassword(reqData){ + return this.postAuxEnd("/stepresetpass", reqData) + } + getCouponRedeem(){ var postData = { uuid: localStorage.getItem("uid"), diff --git a/src/views/VerifyPasswordPages.jsx b/src/views/VerifyPasswordPages.jsx new file mode 100644 index 0000000..2bcba53 --- /dev/null +++ b/src/views/VerifyPasswordPages.jsx @@ -0,0 +1,6 @@ +import React from "react"; +import VerifyPassword from "../components/AuthPages/VerifyPassword"; + +export default function VerifyPasswordPages() { + return ; +}