Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48ea72270f | |||
| 9cb773d360 |
@@ -3,7 +3,6 @@ import FourZeroFour from "./components/FourZeroFour";
|
||||
import ScrollToTop from "./components/Helpers/ScrollToTop";
|
||||
import MyCollection from "./components/MyCollection";
|
||||
import Notification from "./components/Notification";
|
||||
import ThankYou from "./components/AuthPages/ThankYou";
|
||||
import AuthRoute from "./middleware/AuthRoute";
|
||||
import AcitveBidsPage from "./views/AcitveBidsPage";
|
||||
import AuthProfilePage from "./views/AuthProfilePage";
|
||||
@@ -32,7 +31,6 @@ import CalendarPage from "./views/CalendarPage";
|
||||
import ResourcePage from "./views/ResourcePage";
|
||||
import TrackActionPage from "./views/TrackActionPage";
|
||||
import SubscriptionPage from "./views/SubscriptionPage";
|
||||
import VerifySignupCompletePage from "./views/VerifySignupCompletePage";
|
||||
|
||||
export default function Routers() {
|
||||
return (
|
||||
@@ -51,14 +49,8 @@ export default function Routers() {
|
||||
path="/update-password"
|
||||
element={<UpdatePasswordPages />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/confirm-reset"
|
||||
element={<ThankYou />}
|
||||
/>
|
||||
<Route exact path="/verify-you" element={<VerifyYouPages />} />
|
||||
<Route exact path="/verify-signup" element={<VerifySignupPage />} />
|
||||
<Route exact path="/complete-signup" element={<VerifySignupCompletePage />} />
|
||||
|
||||
{/* private route */}
|
||||
<Route element={<AuthRoute />}>
|
||||
|
||||
@@ -3,52 +3,34 @@ import { Link, useNavigate } from 'react-router-dom';
|
||||
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import AuthLayout from "../AuthLayout";
|
||||
import usersService from "../../../services/UsersService";
|
||||
|
||||
export default function ForgotPassword() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const [validation, setValidation] = useState("")
|
||||
const [buttonDisabled, setButtonDisabled] = useState(true)
|
||||
const [loading, setLoading] = useState(false);
|
||||
const user = new usersService()
|
||||
|
||||
// email
|
||||
const [email, setEmail] = useState("");
|
||||
const handleEmail = (e) => {
|
||||
setEmail(e.target.value);
|
||||
};
|
||||
|
||||
|
||||
function validationChecker(email) {
|
||||
const emailCheck = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
|
||||
if (email === "") {
|
||||
setValidation("");
|
||||
setValidation("email is required");
|
||||
|
||||
} else if (!email.match(emailCheck)) {
|
||||
setValidation('Please input a valid email address');
|
||||
|
||||
} else {
|
||||
setValidation("");
|
||||
setButtonDisabled(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async() => {
|
||||
const resetEmail = {
|
||||
username: email,
|
||||
stage: 100
|
||||
}
|
||||
const reset = await user.resetPassword(resetEmail);
|
||||
setLoading(true)
|
||||
|
||||
const {raw_data, uuid} = reset.data
|
||||
localStorage.setItem('reset_uuid', uuid)
|
||||
localStorage.setItem('reset_raw', JSON.stringify(raw_data))
|
||||
if (reset.status == 200){
|
||||
setTimeout(() => {
|
||||
navigate("/verify-you", {replace : true});
|
||||
setLoading(false)
|
||||
}, 2000);
|
||||
}else{
|
||||
setValidation('An error occurred')
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
validationChecker(email)
|
||||
}, [email])
|
||||
@@ -79,21 +61,21 @@ export default function ForgotPassword() {
|
||||
inputHandler={handleEmail}
|
||||
value={email}
|
||||
/>
|
||||
{validation && <p className="my-5 text-center font-light italic subpixel-antialiased tracking-wide text-red-500">{validation}</p>}
|
||||
{validation && <p className="my-5 font-bold text-red-500">{validation}</p>}
|
||||
</div>
|
||||
|
||||
<div className="signin-area mb-3.5">
|
||||
|
||||
<button
|
||||
className="w-full rounded-[50px] h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
disabled={buttonDisabled}
|
||||
onClick={handleSubmit}
|
||||
onClick={() => navigate("/verify-you")}
|
||||
>
|
||||
{loading ? <div className="signup btn-loader"></div> : <span>Send Code</span>}
|
||||
Send Code
|
||||
</button>
|
||||
|
||||
<Link to="/"
|
||||
className="mt-5 cursor-default font-bold flex justify-center subpixel-antialiased tracking-wide text-white items-center h-[58px] rounded-[50px] bg-[#1a3544a2]"
|
||||
className="my-40 font-bold flex justify-center text-red-500 items-center"
|
||||
>
|
||||
Back to Home
|
||||
</Link>
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import React from "react";
|
||||
import AuthLayout from "../../AuthLayout";
|
||||
|
||||
|
||||
export default function CompleteSignUp({ className }) {
|
||||
export default function ThankYou({ className }) {
|
||||
return (
|
||||
<>
|
||||
<AuthLayout
|
||||
slogan="Welcome to myFit"
|
||||
>
|
||||
|
||||
<div
|
||||
className={`content-wrapper xl:bg-white dark:xl:bg-dark-white sm:px-[70px] px-5 2xl:px-[100px] 2xl:h-[818px] xl:h-[650px] rounded-xl flex flex-col justify-center ${
|
||||
className || ""
|
||||
@@ -51,7 +44,5 @@ export default function CompleteSignUp({ className }) {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, {useState} from "react";
|
||||
// import titleShape from "../../../../assets/images/shape/text-shape-three.svg";
|
||||
import titleShape from "../../../../assets/images/shape/title_shape_3.svg";
|
||||
import AuthLayout from "../../AuthLayout";
|
||||
import Otp from "./Otp";
|
||||
@@ -9,7 +10,7 @@ export default function VerifyYou() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const verifyOTP = new usersService();
|
||||
const verify = new usersService();
|
||||
|
||||
const [loading, setLoading] = useState(false) // For loading spinner
|
||||
|
||||
@@ -44,12 +45,12 @@ export default function VerifyYou() {
|
||||
|
||||
setLoading(true) // Sets loading spinner
|
||||
|
||||
let otpCode = '';
|
||||
let code = '';
|
||||
for(let values in verificationCode){
|
||||
otpCode+=verificationCode[values]
|
||||
code+=verificationCode[values]
|
||||
}
|
||||
|
||||
if(!otpCode){ // checks if code is empty
|
||||
if(!code){ // checks if code is empty
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
@@ -57,7 +58,7 @@ export default function VerifyYou() {
|
||||
})
|
||||
return
|
||||
}
|
||||
if(otpCode.length < 6){ // checks if verifiedCode is empty
|
||||
if(code.length < 6){ // checks if verifiedCode is empty
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
@@ -66,15 +67,9 @@ export default function VerifyYou() {
|
||||
return
|
||||
}
|
||||
|
||||
let apiInput = {
|
||||
username: localStorage.getItem('username'),
|
||||
pend_uid: localStorage.getItem('uuid'),
|
||||
random_text: otpCode,
|
||||
mode: 'VERIFY',
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await verifyOTP.signupUser(apiInput)
|
||||
const res = await verify.signupOTPVerify(code);
|
||||
console.log(res)
|
||||
if(res.status != 200){
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
@@ -83,33 +78,15 @@ export default function VerifyYou() {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if(res.status == 200){
|
||||
if(res.data.status < 0) { // when resquest is successful but status is not 100
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
message: res.data.error_msg
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// if request is successful and status is 100 proceed
|
||||
setErrorMessage({
|
||||
success: true,
|
||||
message: 'verification successfully'
|
||||
})
|
||||
|
||||
//clears the temporary uuid and email in tge local storage
|
||||
localStorage.removeItem('uuid')
|
||||
localStorage.removeItem('username')
|
||||
|
||||
setTimeout(()=>{
|
||||
setLoading(false)
|
||||
navigate('/complete-signup', { replace: true })
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// if status code is 200 proceed
|
||||
setErrorMessage({
|
||||
success: true,
|
||||
message: 'verification successfully'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
setLoading(false)
|
||||
navigate('/update-password', { replace: true })
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
|
||||
@@ -6,12 +6,12 @@ import titleShape from "../../../assets/images/shape/title-shape-two.svg";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
import usersService from "../../../services/UsersService"; // site api services
|
||||
import usersService from "../../../services/UsersService";
|
||||
|
||||
export default function SignUp() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const userSignup = new usersService();
|
||||
const userSignupAuth = new usersService();
|
||||
|
||||
const [loading, setLoading] = useState(false) // For loading spinner
|
||||
|
||||
@@ -62,16 +62,6 @@ export default function SignUp() {
|
||||
})
|
||||
return
|
||||
}
|
||||
//checks if email is a valid email address
|
||||
let regEx = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
|
||||
if (regEx.test(email) == false) {
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
message: 'Please Input a valid email; e.g: text@gmail.com'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if(password != confirm_password){ //checks if password matches confirm password
|
||||
setLoading(false)
|
||||
@@ -82,24 +72,10 @@ export default function SignUp() {
|
||||
return
|
||||
}
|
||||
|
||||
//checks if password is matches alphanumeric with at least one uppercase letter
|
||||
// let PwdRegEx = /[A-Z]/;
|
||||
if (/[A-Z]/.test(password) == false) {
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
message: 'Password must contain at least one uppercase character; e.g: Text123'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
userInfo.username = email // assigns email as username also
|
||||
userInfo.mode = 'START' // assigns mode as START
|
||||
|
||||
delete userInfo.confirm_password // deletes confrim password before making API call
|
||||
|
||||
try {
|
||||
const res = await userSignup.signupUser(userInfo);
|
||||
const res = await userSignupAuth.signupAuth(userInfo);
|
||||
if(res.status != 200){
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
@@ -108,31 +84,15 @@ export default function SignUp() {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if(res.status == 200){
|
||||
if(res.data.status < 0) { // when resquest is successful but status is not 1
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
message: 'unable to create account'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// if request is successful and status is 1 proceed
|
||||
setErrorMessage({
|
||||
success: true,
|
||||
message: 'Account created successfully'
|
||||
})
|
||||
|
||||
localStorage.setItem('uuid', res.data.uuid) // Stores the user UUID to localstorage
|
||||
localStorage.setItem('username', email) // Stores the user UUID to localstorage
|
||||
|
||||
setTimeout(()=>{
|
||||
setLoading(false)
|
||||
navigate("/verify-signup", { replace: true })
|
||||
}, 1000)
|
||||
}
|
||||
// if status code is 200 proceed
|
||||
setErrorMessage({
|
||||
success: true,
|
||||
message: 'Account created successfully'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
setLoading(false)
|
||||
navigate("/verify-signup", { replace: true })
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
@@ -141,7 +101,6 @@ export default function SignUp() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="layout-wrapper">
|
||||
@@ -182,7 +141,7 @@ export default function SignUp() {
|
||||
name="firstname"
|
||||
type="text"
|
||||
iconName="people"
|
||||
value={userDetails.first_name}
|
||||
value={userDetails.firstname}
|
||||
inputHandler={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
@@ -193,7 +152,7 @@ export default function SignUp() {
|
||||
name="lastname"
|
||||
type="text"
|
||||
iconName="people"
|
||||
value={userDetails.Last_name}
|
||||
value={userDetails.lastname}
|
||||
inputHandler={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
@@ -269,9 +228,7 @@ export default function SignUp() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="signin-area mb-1">
|
||||
|
||||
{errorMessage.message != '' && <p className={`text-center p-3 ${errorMessage.success ? 'text-green-600' : 'text-red-600'}`}>{errorMessage.message}</p>}
|
||||
|
||||
{errorMessage.message != '' && <p className={`text-center p-3 ${errorMessage.success ? 'text-green-600' : 'text-red-600'}`}>{errorMessage.message}</p>}
|
||||
<button
|
||||
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
// onClick={() => navigate("/verify-signup")}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import React from "react";
|
||||
import AuthLayout from "../../AuthPages/AuthLayout";
|
||||
|
||||
export default function ThankYou({ className }) {
|
||||
return (
|
||||
<>
|
||||
<AuthLayout slogan='Welcome to myFit'>
|
||||
<div
|
||||
<div
|
||||
className={`content-wrapper xl:bg-white dark:xl:bg-dark-white sm:px-[70px] px-5 2xl:px-[100px] 2xl:h-[818px] xl:h-[650px] rounded-xl flex flex-col justify-center ${
|
||||
className || ""
|
||||
}`}
|
||||
@@ -47,7 +44,5 @@ export default function ThankYou({ className }) {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,87 +1,17 @@
|
||||
import React, { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import AuthLayout from "../AuthLayout";
|
||||
import ThankYou from "../ThankYou";
|
||||
import usersService from "../../../services/UsersService";
|
||||
|
||||
export default function UpdatePassword() {
|
||||
const [values, setValues] = useState({
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
})
|
||||
const [updated, setValue] = useState(false);
|
||||
const [message, setMessage] = useState(false);
|
||||
const [validation, setValidation] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const updatePass = new usersService()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const onChange = (e) => {
|
||||
setValues((prev) => ({ ...prev, [e.target.name]: e.target.value }));
|
||||
};
|
||||
|
||||
const updatePassword = async (e) => {
|
||||
const {username} = JSON.parse(localStorage.getItem('reset_raw'))
|
||||
const otpCode = localStorage.getItem('otp')
|
||||
|
||||
setLoading(true)
|
||||
|
||||
if(!values.password || !values.confirmPassword){
|
||||
setLoading(false)
|
||||
setValidation("Please Fill empty inputs")
|
||||
return
|
||||
}
|
||||
|
||||
const regex = /^[A-Za-z]\w{7,14}$/
|
||||
if(regex.test(values.password) == false) {
|
||||
setLoading(false)
|
||||
setValidation("it must be a least 7 alphanumeric characters")
|
||||
return
|
||||
}
|
||||
|
||||
if (values.password != values.confirmPassword){
|
||||
setLoading(false)
|
||||
setValidation("Password does not match")
|
||||
return
|
||||
}
|
||||
|
||||
const newPassword = {
|
||||
username: username,
|
||||
reset_uuid: localStorage.getItem('reset_uuid'),
|
||||
random_text: otpCode,
|
||||
member_uid: localStorage.getItem('member_uid'),
|
||||
new_password: values.password,
|
||||
stage: 300
|
||||
}
|
||||
|
||||
delete values.confirmPassword
|
||||
|
||||
try {
|
||||
const confirm = await updatePass.resetPassword(newPassword)
|
||||
console.log(confirm)
|
||||
|
||||
if(confirm.status != 200){
|
||||
setLoading(false)
|
||||
setValidation("Sorry, could not verify code")
|
||||
return
|
||||
}
|
||||
|
||||
localStorage.removeItem('reset_uuid')
|
||||
localStorage.removeItem('reset_raw')
|
||||
localStorage.removeItem('otp')
|
||||
|
||||
if(confirm.status == 200){
|
||||
setValidation("Password updated")
|
||||
setTimeout(() => {
|
||||
setLoading(false)
|
||||
navigate("/confirm-reset", {replace : true});
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
setValidation("An error occurred")
|
||||
}
|
||||
const updatePassword = () => {
|
||||
setValue(!updated);
|
||||
setTimeout(() => {
|
||||
setMessage(!message);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -89,6 +19,7 @@ export default function UpdatePassword() {
|
||||
<AuthLayout
|
||||
slogan="Welcome to myFit"
|
||||
>
|
||||
{updated === false ? (
|
||||
<div className="content-wrapper update-password-section xl:bg-white dark:bg-dark-white w-full 2xl:h-[818px] xl:h-[600px] sm:w-auto sm:px-[70px] px-5 2xl:px-[100px] rounded-xl flex flex-col justify-center">
|
||||
<div>
|
||||
<div className="title-area relative flex flex-col justify-center items-center mb-7">
|
||||
@@ -101,7 +32,7 @@ export default function UpdatePassword() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-area">
|
||||
{/* <div className="input-item mb-5">
|
||||
<div className="input-item mb-5">
|
||||
<InputCom
|
||||
placeholder="*********"
|
||||
label="Old Password"
|
||||
@@ -109,7 +40,7 @@ export default function UpdatePassword() {
|
||||
type="password"
|
||||
iconName="password"
|
||||
/>
|
||||
</div> */}
|
||||
</div>
|
||||
<div className="input-item mb-5">
|
||||
<InputCom
|
||||
placeholder="*********"
|
||||
@@ -117,35 +48,32 @@ export default function UpdatePassword() {
|
||||
name="password"
|
||||
type="password"
|
||||
iconName="password"
|
||||
inputHandler={onChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-item mb-5">
|
||||
<InputCom
|
||||
placeholder="*********"
|
||||
label="Re-enter Password"
|
||||
name="confirmPassword"
|
||||
name="password"
|
||||
type="password"
|
||||
iconName="password"
|
||||
inputHandler={onChange}
|
||||
/>
|
||||
</div>
|
||||
{validation && <p className={`my-5 text-center font-light italic text-sm subpixel-antialiased tracking-wide ${validation == 'Password updated' ? 'text-green-600' : 'text-red-500'} `}>{validation}</p>}
|
||||
<div className="signin-area mb-3.5">
|
||||
<button
|
||||
onClick={updatePassword}
|
||||
type="button"
|
||||
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
>
|
||||
{loading ? <div className="signup btn-loader"></div> : <span>Continue</span>}
|
||||
Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* // : (
|
||||
// <ThankYou className={`thankyou-section ${message ? "active" : ""}`} />
|
||||
// )} */}
|
||||
</div>
|
||||
) : (
|
||||
<ThankYou className={`thankyou-section ${message ? "active" : ""}`} />
|
||||
)}
|
||||
</AuthLayout>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
export default function Otp({handleChange, value}) {
|
||||
export default function Otp() {
|
||||
useEffect(() => {
|
||||
const otp = document.querySelector("#otp-inputs");
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pin of otp.children) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
pin.onkeyup = (value) => {
|
||||
if(pin.children){
|
||||
if(value.key === '' || value.key === ' ' || value.key === 'ArrowRight' || value.key === 'ArrowLeft' || value.key === 'ArrowUp' || value.key === 'ArrowDown' || value.key === 'Tab') return;
|
||||
if(value.key === 'Backspace'){
|
||||
if(pin.previousSibling){
|
||||
pin.previousSibling.children.otp.focus();
|
||||
} else {return;}
|
||||
} else {
|
||||
pin.nextSibling.children.otp.focus();
|
||||
}
|
||||
pin.onkeyup = () => {
|
||||
if (pin.nextSibling) {
|
||||
pin.nextSibling.children.otp.focus();
|
||||
}
|
||||
};
|
||||
}
|
||||
}, []);
|
||||
|
||||
};
|
||||
}
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
@@ -33,9 +25,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_one'
|
||||
value={value.value_one}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] sm:w-14 sm:h-14 w-12 h-12 rounded-[50px] overflow-hidden relative ">
|
||||
@@ -44,9 +33,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_two'
|
||||
value={value.value_two}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] sm:w-14 sm:h-14 w-12 h-12 rounded-[50px] overflow-hidden relative ">
|
||||
@@ -55,9 +41,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_three'
|
||||
value={value.value_three}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] sm:w-14 sm:h-14 w-12 h-12 rounded-[50px] overflow-hidden relative ">
|
||||
@@ -66,9 +49,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_four'
|
||||
value={value.value_four}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] sm:w-14 sm:h-14 w-12 h-12 rounded-[50px] overflow-hidden relative ">
|
||||
@@ -77,9 +57,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_five'
|
||||
value={value.value_five}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] sm:w-14 sm:h-14 w-12 h-12 rounded-[50px] overflow-hidden relative ">
|
||||
@@ -88,9 +65,6 @@ export default function Otp({handleChange, value}) {
|
||||
type="text"
|
||||
maxLength={1}
|
||||
id="otp"
|
||||
name='value_six'
|
||||
value={value.value_six}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,90 +1,9 @@
|
||||
import React,{useState} from "react";
|
||||
import {useNavigate} from "react-router-dom"
|
||||
import React from "react";
|
||||
import titleShape from "../../../assets/images/shape/text-shape-three.svg";
|
||||
import AuthLayout from "../AuthLayout";
|
||||
import Otp from "./Otp";
|
||||
import usersService from "../../../services/UsersService";
|
||||
|
||||
export default function VerifyYou() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [validation, setValidation] = useState("");
|
||||
const verifyOTP = new usersService()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [verificationCode, setVerificationCode] = useState({
|
||||
value_one: '',
|
||||
value_two: ''
|
||||
})
|
||||
|
||||
const handleVerificationInput = ({target:{name, value}}) => {
|
||||
setVerificationCode(prev => {
|
||||
return {...prev, [name]:value}
|
||||
})
|
||||
}
|
||||
|
||||
const handleSubmit = async() => {
|
||||
setValidation("")
|
||||
setLoading(true)
|
||||
|
||||
let otpCode = '';
|
||||
for(let values in verificationCode){
|
||||
otpCode+=verificationCode[values]
|
||||
}
|
||||
|
||||
// Validating otp code
|
||||
if(!otpCode) {
|
||||
setLoading(false)
|
||||
setValidation("Please enter your otp code")
|
||||
return
|
||||
}
|
||||
if(otpCode.length < 6) {
|
||||
setLoading(false)
|
||||
setValidation("OTP code incomplete")
|
||||
return
|
||||
}
|
||||
|
||||
const {username} = JSON.parse(localStorage.getItem('reset_raw'))
|
||||
const verifyEmail = {
|
||||
username: username,
|
||||
stage: 200,
|
||||
reset_uuid: localStorage.getItem('reset_uuid'),
|
||||
random_text: otpCode
|
||||
}
|
||||
|
||||
localStorage.setItem('otp', otpCode)
|
||||
|
||||
try {
|
||||
const verify = await verifyOTP.resetPassword(verifyEmail);
|
||||
console.log(verify)
|
||||
localStorage.setItem('member_uid', verify.data.member_uid);
|
||||
if (verify.status != 200){
|
||||
setValidation("Sorry, could not verify code")
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
if (verify.status == 200){
|
||||
|
||||
if(verify?.data.error_msg == "Unable to continue"){
|
||||
setLoading(false)
|
||||
setValidation("Incorrect otp code")
|
||||
return
|
||||
}
|
||||
|
||||
setValidation("verified successfully")
|
||||
|
||||
setTimeout(() => {
|
||||
setLoading(false)
|
||||
navigate("/update-password", {replace : true});
|
||||
}, 2000);
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
setValidation('An error occurred')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<AuthLayout
|
||||
@@ -101,22 +20,20 @@ export default function VerifyYou() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-area">
|
||||
<Otp handleChange={handleVerificationInput} value={verificationCode} />
|
||||
{validation && <p className={`my-5 text-center font-light italic text-sm subpixel-antialiased tracking-wide ${validation == 'verified successfully' ? 'text-green-600' : 'text-red-500'} `}>{validation}</p>}
|
||||
<Otp />
|
||||
<div className="signin-area mb-3.5">
|
||||
<a
|
||||
// href="/update-password"
|
||||
href="/update-password"
|
||||
className="w-full rounded-[50px] h-[58px] mb-6 text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
{loading ? <div className="signup btn-loader"></div> : <span>Continue</span>}
|
||||
Continue
|
||||
</a>
|
||||
</div>
|
||||
<div className="resend-code flex justify-center">
|
||||
<p className="text-lg text-thin-light-gray font-normal">
|
||||
Dont’t have an aceount ?
|
||||
<a href="/signup" className="ml-2 text-dark-gray dark:text-white font-bold">
|
||||
Sign Up
|
||||
<a href="#" className="ml-2 text-dark-gray dark:text-white font-bold">
|
||||
Please resend
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +76,8 @@ export default function TrackItemCard({ datas, hidden = false }) {
|
||||
</div>
|
||||
</div>
|
||||
{/* user */}
|
||||
<div className="user w-full text-center mt-[14px]">
|
||||
<div className="user w-full text-center">
|
||||
|
||||
<p className="text-sm text-thin-light-gray dark:text-white">
|
||||
<Link
|
||||
to={`/track-action/${datas.widget}`}
|
||||
|
||||
@@ -76,7 +76,7 @@ export default function AddEditReminder({ className }) {
|
||||
setMessage({status: true, message: ''})
|
||||
let {description, notes, category, mode} = infoDetail
|
||||
//CHECKING IF AN EMPTY FIELD WAS PASSED
|
||||
if(!description || !category || !mode){
|
||||
if(!description || !notes || !category || !mode){
|
||||
setSuccess(false)
|
||||
setMessage({status: false, message: 'All fields must be filled'})
|
||||
return
|
||||
|
||||
@@ -669,7 +669,6 @@ TODO: Responsive ===========================
|
||||
.nft-userprofile-wrapper .content-wrapper-profile-only .auth {
|
||||
margin-top: -70px;
|
||||
}
|
||||
.react-date-picker__calendar {width: 290px;}
|
||||
}
|
||||
@media (max-width: 376px) {
|
||||
.notification-page .content-item .notifications {
|
||||
@@ -678,7 +677,6 @@ TODO: Responsive ===========================
|
||||
.notification-page .content-item .notifications .icon {
|
||||
@apply mb-2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Calendar */
|
||||
@@ -768,11 +766,6 @@ TODO: Responsive ===========================
|
||||
}
|
||||
|
||||
/* Date Picker */
|
||||
.react-date-picker{
|
||||
display: flex !important;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.react-date-picker__wrapper{
|
||||
border: 0.5px solid #E3E4FE;
|
||||
padding: 1.25rem;
|
||||
@@ -790,7 +783,6 @@ TODO: Responsive ===========================
|
||||
|
||||
.dark .react-date-picker__button svg{stroke: #7B818D;}
|
||||
|
||||
.react-date-picker__calendar {inset: 100% 25px auto auto !important;}
|
||||
.react-date-picker__calendar .react-calendar{
|
||||
min-height: 18.4rem;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@ class usersService {
|
||||
console.log("Er are here anyway");
|
||||
}
|
||||
|
||||
// Reset Password
|
||||
resetPassword(reqData) {
|
||||
return this.postAuxEnd('/resetpass', reqData);
|
||||
}
|
||||
|
||||
logInUser(reqData) {
|
||||
localStorage.setItem("session_token", ``);
|
||||
return this.postAuxEnd("/login", reqData);
|
||||
@@ -21,10 +16,15 @@ class usersService {
|
||||
}
|
||||
|
||||
//SIGNUP AUTH
|
||||
signupUser(reqData){
|
||||
signupAuth(reqData){
|
||||
return this.postAuxEnd("/account", reqData);
|
||||
}
|
||||
|
||||
//SIGNUP OTP VERIFICATION AUTH
|
||||
signupOTPVerify(reqData){
|
||||
return this.postAuxEnd("/signup-code", reqData);
|
||||
}
|
||||
|
||||
getUserReminders(){
|
||||
var reqData = {
|
||||
member_id: localStorage.getItem("member_id")
|
||||
@@ -133,7 +133,7 @@ class usersService {
|
||||
if (error.response) {
|
||||
//response status is an error code
|
||||
console.log("ERROR-------------------------------------------------------");
|
||||
console.log(error.response.status, 'err');
|
||||
console.log(error.response.status);
|
||||
console.log("ERROR-------------------------------------------------------");
|
||||
} else if (error.request) {
|
||||
//response not received though the request was sent
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import React from "react";
|
||||
import CompleteSignUp from "../components/AuthPages/SignUp/CompleteSignUp";
|
||||
|
||||
export default function VerifySignupCompletePage() {
|
||||
return <CompleteSignUp />;
|
||||
}
|
||||
Reference in New Issue
Block a user