diff --git a/src/Routers.jsx b/src/Routers.jsx index 061a28d..ca6ebcc 100644 --- a/src/Routers.jsx +++ b/src/Routers.jsx @@ -50,7 +50,7 @@ export default function Routers() { element={} /> } /> - } /> + } /> {/* private route */} }> diff --git a/src/components/AuthPages/ForgotPassword/index.jsx b/src/components/AuthPages/ForgotPassword/index.jsx index 589d446..65bdbe7 100644 --- a/src/components/AuthPages/ForgotPassword/index.jsx +++ b/src/components/AuthPages/ForgotPassword/index.jsx @@ -11,6 +11,7 @@ export default function ForgotPassword() { // email const [email, setMail] = useState(""); const [msgError, setMsgError] = useState(''); + const [msgSuccess, setMsgSuccess] = useState(false) const navigate = useNavigate(); const userApi = new usersService(); @@ -20,8 +21,8 @@ export default function ForgotPassword() { }; const humanChecker = () => { - setValue(!checked); - }; + setValue(!checked) + } const resetHandler = async () => { if (email == '') { @@ -30,24 +31,16 @@ export default function ForgotPassword() { setMsgError('Check if you are human') } - if (email != '' && checked) { + if (email !== '' && checked) { const reqData = { email } setResetLoading(true) try { const res = await userApi.StartResetPassword(reqData) if (res.status === 200) { - const { data } = res - if (data.status == -1) { - setMsgError('This is an incorrect or duplicate email') - setResetLoading(false) - } else if (data.status > 0) { - setResetLoading(false) - navigate("/verify-you", { replace: true }) - } else{ - setMsgError("reset was not successful") - setResetLoading(false) - } + setMsgSuccess(true) setMail("") + setValue(false) + setResetLoading(false) } } catch (error) { setResetLoading(false) @@ -79,12 +72,10 @@ export default function ForgotPassword() {
-

+

Forget Password

- Enter your email to reset your password. + Enter your email to reset your password.
@@ -98,7 +89,6 @@ export default function ForgotPassword() { iconName="message" />
- {msgError &&
{msgError}
} {/* hCaptha clone for the time being */}
@@ -108,7 +98,7 @@ export default function ForgotPassword() {
- +
@@ -126,12 +116,15 @@ export default function ForgotPassword() {
+ {msgError &&
{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/Login/index.jsx b/src/components/AuthPages/Login/index.jsx index f06a758..7d18634 100644 --- a/src/components/AuthPages/Login/index.jsx +++ b/src/components/AuthPages/Login/index.jsx @@ -99,12 +99,10 @@ export default function Login() {
-

+

Sign In to WrenchBoard

- New Here? Create an Account + New Here? Create an Account
@@ -118,7 +116,6 @@ export default function Login() { iconName="message" />
-
*/} - {loginError &&
Invalid username or password- Please reset your password or create a new account
} - {msgError &&
{msgError}
} + {loginError &&
Invalid username or password- Please reset your password or create a new account
} + {msgError &&
{msgError}
}
*/} -
This site is protected by hCaptcha and the our Privacy Policy and Terms of Service apply.
+
This site is protected by hCaptcha and the our Privacy Policy and Terms of Service apply.
@@ -216,8 +212,8 @@ const BrandBtn = ({ className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[0.475rem] h-[48px] flex justify-center bg-[#FAFAFA] hover:bg-[#eff2f5] hover:text-[#7e8299] transition duration-300 dark:bg-[#11131F] items-center font-medium cursor-pointer" > logo-icon(s) - - Sign In with {brand} + + Continue with {brand}
diff --git a/src/components/AuthPages/SignUp/index.jsx b/src/components/AuthPages/SignUp/index.jsx index 549a501..8224c6c 100644 --- a/src/components/AuthPages/SignUp/index.jsx +++ b/src/components/AuthPages/SignUp/index.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { useNavigate, Link } from "react-router-dom"; import facebookLogo from "../../../assets/images/facebook-4.svg"; import WrenchBoard from "../../../assets/images/wrenchboard.png"; @@ -6,10 +6,10 @@ import usersService from "../../../services/UsersService"; import InputCom from "../../Helpers/Inputs/InputCom"; export default function SignUp() { - const [signUpLoading, setSignUpLoading] = useState(false) + const [signUpLoading, setSignUpLoading] = useState(false); const [checked, setValue] = useState(false); // for the catch error - const [msgError, setMsgError] = useState(''); + const [msgError, setMsgError] = useState(""); const [showPassword, setShowPassword] = useState(false); const [countries, setCountries] = useState([]); @@ -18,7 +18,7 @@ export default function SignUp() { first_name: "", last_name: "", email: "", - password: "" + password: "", }); const handleInputChange = (event) => { @@ -39,31 +39,36 @@ export default function SignUp() { const userApi = new usersService(); // Get Country Api - const getCountryList = async () => { - const res = await userApi.getSignupCountryData() + const getCountryList = useCallback(async () => { + const res = await userApi.getSignupCountryData(); try { if (res.status === 200) { - const { signup_country } = await res.data - setCountries(signup_country) + const { signup_country } = await res.data; + setCountries(signup_country); } else if (res.data.result !== 100) { - setCountries('Nothing see here!') + setCountries("Nothing see here!"); } } catch (error) { - throw new Error(error) + throw new Error(error); } - } + }, []); const handleSignUp = async () => { - let { country, first_name, last_name, email, password } = formData + let { country, first_name, last_name, email, password } = formData; - if (email === '' && password === '' && first_name === '') { - setMsgError('Please fill in fields') + if (email === "" && password === "" && first_name === "") { + setMsgError("Please fill in fields"); } try { - if (email !== '' && password !== '' && first_name !== '' && last_name !== '') { - setSignUpLoading(true) + if ( + email !== "" && + password !== "" && + first_name !== "" && + last_name !== "" + ) { + setSignUpLoading(true); const reqData = { country: country, firstname: first_name, @@ -72,50 +77,40 @@ export default function SignUp() { username: email, password: password, terms: 1, - news: 1 - } + news: 1, + }; - const res = await userApi.CreateUser(reqData) + const res = await userApi.CreateUser(reqData); if (res.status === 200) { - const { data } = res - if (data.status === -1 && data.acc === 'DULPICATE') { - setMsgError('This account has been already created') - setSignUpLoading(false) + const { data } = res; + if (data.status === -1 && data.acc === "DULPICATE") { + setMsgError("This account has been already created"); + setSignUpLoading(false); } - if (data && data.status === '1') { + if (data && data.status === "1") { setTimeout(() => { - navigate("/verify-you", { replace: true }); - setSignUpLoading(false) - }, 2000) - } else { - setSignUpLoading(false) - setMsgError('This account does not exist') + navigate("/outmessage", { replace: true }); + setSignUpLoading(false); + }, 2000); } } else { - setSignUpLoading(false) - setMsgError('An error occurred') + setSignUpLoading(false); + setMsgError("An error occurred"); } } } catch (error) { - throw new Error(error) + throw new Error(error); } finally { setTimeout(() => { - setMsgError(null) - }, process.env.REACT_APP_SIGNUP_ERROR_TIMEOUT) - setFormData({ - first_name: '', - last_name: '', - email: '', - country: '', - password: '' - }) + setMsgError(null); + }, process.env.REACT_APP_SIGNUP_ERROR_TIMEOUT); } - } + }; useEffect(() => { - getCountryList() - }) + getCountryList(); + }); return ( <> @@ -124,36 +119,52 @@ export default function SignUp() {
-
- - wrenchboard +
+ + wrenchboard
-

+

Create Account

- Already have an account? Sign in here + + Already have an account?{" "} + + Sign in here + +
- OR + + OR +
- {msgError &&
{msgError}
} + {msgError && ( +
+ {msgError} +
+ )}
@@ -245,8 +262,7 @@ export default function SignUp() {
-) +); 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. + 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.

-
-) \ No newline at end of file +); diff --git a/src/components/AuthPages/VerifyYou/index.jsx b/src/components/AuthPages/VerifyYou/index.jsx index 5cf2fee..c8d8831 100644 --- a/src/components/AuthPages/VerifyYou/index.jsx +++ b/src/components/AuthPages/VerifyYou/index.jsx @@ -1,31 +1,49 @@ +import { useNavigate, Link } from "react-router-dom"; import AuthLayout from "../AuthLayout"; +import WrenchBoard from "../../../assets/images/wrenchboard.png" export default function VerifyYou() { + const navigate = useNavigate() return ( <> -
-
-
-

- Verification Sent -

+
+
+ + wrenchboard + +
+
+
+
+

+ Let's verify your email now +

+ 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. +

+
+
+

+ 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. +

+
+
+
+
-
-
-

- To complete the verification process, you should check your email inbox and look for the verification email. It may take a few minutes for the email to arrive, so be patient. Once you receive the email, open it and click on the verification link provided. -

-
-
-

- If you haven't received the verification email after a reasonable amount of time, make sure to check your spam or junk mail folder. It's also possible that the email was sent to the wrong email address, so double-check that you entered your email address correctly. -

-
diff --git a/src/components/Helpers/Inputs/InputCom/index.jsx b/src/components/Helpers/Inputs/InputCom/index.jsx index 6d601b8..3479d73 100644 --- a/src/components/Helpers/Inputs/InputCom/index.jsx +++ b/src/components/Helpers/Inputs/InputCom/index.jsx @@ -70,20 +70,20 @@ export default function InputCom({
{label && ( )} - {forgotPassword && Forgot Password?} + {forgotPassword && Forgot Password?}
{ + func.apply(context, args); + }, delay); + }; +} diff --git a/src/services/UsersService.js b/src/services/UsersService.js index 5e87cdc..5885e64 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -11,6 +11,11 @@ class usersService { return this.postAuxEnd("/createuser", reqData); } + CompleteSignUp(reqData){ + localStorage.setItem("session_token", ``); + return this.postAuxEnd("/completesignuplink", reqData); + } + getHomeDate(){ var postData = { uuid: localStorage.getItem("uuid"),