Compare commits

..

16 Commits

Author SHA1 Message Date
Chukwumdiebube d7025b9c19 changed input type 2023-03-02 21:44:50 +01:00
Chukwumdiebube e574f6d49d added other stages 2023-03-02 21:36:19 +01:00
tokslaw 32efae78ea Merge branch 'resize' of MyFit/users-myfit into master 2023-03-02 11:35:17 +00:00
tokslaw aefd7675b3 Merge branch 'verify_code_bug_fix' of MyFit/users-myfit into master 2023-03-02 11:27:46 +00:00
victorAnumudu c130c056f8 signup verify code bug fix 2023-03-02 09:37:35 +01:00
Chukwumdiebube 4dd99ec2d9 fixed size for mobile view 2023-02-28 23:45:34 +01:00
Chukwumdiebube 3ef3297dfc resized datepicker component 2023-02-28 21:16:55 +01:00
tokslaw be32be1ecd Merge branch 'signup_OTP_verification' of MyFit/users-myfit into master 2023-02-27 17:41:48 +00:00
victorAnumudu 62fe0dabec verified otp and made curry underline to straight line 2023-02-27 14:44:52 +01:00
tokslaw 77be53424a Merge branch 'reset-password' of MyFit/users-myfit into master 2023-02-27 12:51:05 +00:00
tokslaw da29fd3307 Merge branch 'signup_validation' of MyFit/users-myfit into master 2023-02-27 12:50:52 +00:00
victorAnumudu 1a599cd582 implemented signup validation 2023-02-27 13:18:53 +01:00
Chukwumdiebube 7d612ef03a Reset Password activated 2023-02-27 11:44:01 +01:00
jenkins 6254df4f2a sign up 2023-02-25 18:35:05 -05:00
tokslaw caf3eff237 Merge branch 'Tracking-image' of MyFit/users-myfit into master 2023-02-21 14:07:17 +00:00
Chukwumdiebube 0672cc88c3 Tracking Images 2023-02-20 22:33:05 +01:00
14 changed files with 384 additions and 84 deletions
+8
View File
@@ -3,6 +3,7 @@ import FourZeroFour from "./components/FourZeroFour";
import ScrollToTop from "./components/Helpers/ScrollToTop"; import ScrollToTop from "./components/Helpers/ScrollToTop";
import MyCollection from "./components/MyCollection"; import MyCollection from "./components/MyCollection";
import Notification from "./components/Notification"; import Notification from "./components/Notification";
import ThankYou from "./components/AuthPages/ThankYou";
import AuthRoute from "./middleware/AuthRoute"; import AuthRoute from "./middleware/AuthRoute";
import AcitveBidsPage from "./views/AcitveBidsPage"; import AcitveBidsPage from "./views/AcitveBidsPage";
import AuthProfilePage from "./views/AuthProfilePage"; import AuthProfilePage from "./views/AuthProfilePage";
@@ -31,6 +32,7 @@ import CalendarPage from "./views/CalendarPage";
import ResourcePage from "./views/ResourcePage"; import ResourcePage from "./views/ResourcePage";
import TrackActionPage from "./views/TrackActionPage"; import TrackActionPage from "./views/TrackActionPage";
import SubscriptionPage from "./views/SubscriptionPage"; import SubscriptionPage from "./views/SubscriptionPage";
import VerifySignupCompletePage from "./views/VerifySignupCompletePage";
export default function Routers() { export default function Routers() {
return ( return (
@@ -49,8 +51,14 @@ export default function Routers() {
path="/update-password" path="/update-password"
element={<UpdatePasswordPages />} element={<UpdatePasswordPages />}
/> />
<Route
exact
path="/confirm-reset"
element={<ThankYou />}
/>
<Route exact path="/verify-you" element={<VerifyYouPages />} /> <Route exact path="/verify-you" element={<VerifyYouPages />} />
<Route exact path="/verify-signup" element={<VerifySignupPage />} /> <Route exact path="/verify-signup" element={<VerifySignupPage />} />
<Route exact path="/complete-signup" element={<VerifySignupCompletePage />} />
{/* private route */} {/* private route */}
<Route element={<AuthRoute />}> <Route element={<AuthRoute />}>
@@ -3,34 +3,52 @@ import { Link, useNavigate } from 'react-router-dom';
import titleShape from "../../../assets/images/shape/title-shape-two.svg"; import titleShape from "../../../assets/images/shape/title-shape-two.svg";
import InputCom from "../../Helpers/Inputs/InputCom"; import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout"; import AuthLayout from "../AuthLayout";
import usersService from "../../../services/UsersService";
export default function ForgotPassword() { export default function ForgotPassword() {
const navigate = useNavigate(); const navigate = useNavigate();
const [validation, setValidation] = useState("") const [validation, setValidation] = useState("")
const [buttonDisabled, setButtonDisabled] = useState(true) const [buttonDisabled, setButtonDisabled] = useState(true)
const [loading, setLoading] = useState(false);
const user = new usersService()
// email
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
const handleEmail = (e) => { const handleEmail = (e) => {
setEmail(e.target.value); setEmail(e.target.value);
}; };
function validationChecker(email) { function validationChecker(email) {
const emailCheck = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/; const emailCheck = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
if (email === "") { if (email === "") {
setValidation("email is required"); setValidation("");
} else if (!email.match(emailCheck)) { } else if (!email.match(emailCheck)) {
setValidation('Please input a valid email address'); setValidation('Please input a valid email address');
} else { } else {
setValidation("");
setButtonDisabled(false) 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(() => { useEffect(() => {
validationChecker(email) validationChecker(email)
}, [email]) }, [email])
@@ -61,21 +79,21 @@ export default function ForgotPassword() {
inputHandler={handleEmail} inputHandler={handleEmail}
value={email} value={email}
/> />
{validation && <p className="my-5 font-bold text-red-500">{validation}</p>} {validation && <p className="my-5 text-center font-light italic subpixel-antialiased tracking-wide text-red-500">{validation}</p>}
</div> </div>
<div className="signin-area mb-3.5"> <div className="signin-area mb-3.5">
<button <button
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center" className="w-full rounded-[50px] h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
disabled={buttonDisabled} disabled={buttonDisabled}
onClick={() => navigate("/verify-you")} onClick={handleSubmit}
> >
Send Code {loading ? <div className="signup btn-loader"></div> : <span>Send Code</span>}
</button> </button>
<Link to="/" <Link to="/"
className="my-40 font-bold flex justify-center text-red-500 items-center" className="mt-5 cursor-default font-bold flex justify-center subpixel-antialiased tracking-wide text-white items-center h-[58px] rounded-[50px] bg-[#1a3544a2]"
> >
Back to Home Back to Home
</Link> </Link>
@@ -1,7 +1,14 @@
import React from "react"; import React from "react";
import AuthLayout from "../../AuthLayout";
export default function ThankYou({ className }) {
export default function CompleteSignUp({ className }) {
return ( 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={`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 || "" className || ""
@@ -44,5 +51,7 @@ export default function ThankYou({ className }) {
</a> </a>
</div> </div>
</div> </div>
</AuthLayout>
</>
); );
} }
@@ -1,5 +1,4 @@
import React, {useState} from "react"; 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 titleShape from "../../../../assets/images/shape/title_shape_3.svg";
import AuthLayout from "../../AuthLayout"; import AuthLayout from "../../AuthLayout";
import Otp from "./Otp"; import Otp from "./Otp";
@@ -10,7 +9,7 @@ export default function VerifyYou() {
const navigate = useNavigate(); const navigate = useNavigate();
const verify = new usersService(); const verifyOTP = new usersService();
const [loading, setLoading] = useState(false) // For loading spinner const [loading, setLoading] = useState(false) // For loading spinner
@@ -45,12 +44,12 @@ export default function VerifyYou() {
setLoading(true) // Sets loading spinner setLoading(true) // Sets loading spinner
let code = ''; let otpCode = '';
for(let values in verificationCode){ for(let values in verificationCode){
code+=verificationCode[values] otpCode+=verificationCode[values]
} }
if(!code){ // checks if code is empty if(!otpCode){ // checks if code is empty
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
success: false, success: false,
@@ -58,7 +57,7 @@ export default function VerifyYou() {
}) })
return return
} }
if(code.length < 6){ // checks if verifiedCode is empty if(otpCode.length < 6){ // checks if verifiedCode is empty
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
success: false, success: false,
@@ -67,9 +66,15 @@ export default function VerifyYou() {
return return
} }
let apiInput = {
username: localStorage.getItem('username'),
pend_uid: localStorage.getItem('uuid'),
random_text: otpCode,
mode: 'VERIFY',
}
try { try {
const res = await verify.signupOTPVerify(code); const res = await verifyOTP.signupUser(apiInput)
console.log(res)
if(res.status != 200){ if(res.status != 200){
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
@@ -78,15 +83,33 @@ export default function VerifyYou() {
}) })
return return
} }
// if status code is 200 proceed
setErrorMessage({ if(res.status == 200){
success: true, if(res.data.status < 0) { // when resquest is successful but status is not 100
message: 'verification successfully' setLoading(false)
}) setErrorMessage({
setTimeout(()=>{ success: false,
setLoading(false) message: res.data.error_msg
navigate('/update-password', { replace: true }) })
}, 1000) 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)
}
} catch (error) { } catch (error) {
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
+58 -15
View File
@@ -6,12 +6,12 @@ import titleShape from "../../../assets/images/shape/title-shape-two.svg";
import InputCom from "../../Helpers/Inputs/InputCom"; import InputCom from "../../Helpers/Inputs/InputCom";
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import usersService from "../../../services/UsersService"; import usersService from "../../../services/UsersService"; // site api services
export default function SignUp() { export default function SignUp() {
const navigate = useNavigate(); const navigate = useNavigate();
const userSignupAuth = new usersService(); const userSignup = new usersService();
const [loading, setLoading] = useState(false) // For loading spinner const [loading, setLoading] = useState(false) // For loading spinner
@@ -62,6 +62,16 @@ export default function SignUp() {
}) })
return 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 if(password != confirm_password){ //checks if password matches confirm password
setLoading(false) setLoading(false)
@@ -72,10 +82,24 @@ export default function SignUp() {
return 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 delete userInfo.confirm_password // deletes confrim password before making API call
try { try {
const res = await userSignupAuth.signupAuth(userInfo); const res = await userSignup.signupUser(userInfo);
if(res.status != 200){ if(res.status != 200){
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
@@ -84,15 +108,31 @@ export default function SignUp() {
}) })
return return
} }
// if status code is 200 proceed
setErrorMessage({ if(res.status == 200){
success: true, if(res.data.status < 0) { // when resquest is successful but status is not 1
message: 'Account created successfully' setLoading(false)
}) setErrorMessage({
setTimeout(()=>{ success: false,
setLoading(false) message: 'unable to create account'
navigate("/verify-signup", { replace: true }) })
}, 1000) 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)
}
} catch (error) { } catch (error) {
setLoading(false) setLoading(false)
setErrorMessage({ setErrorMessage({
@@ -101,6 +141,7 @@ export default function SignUp() {
}) })
} }
} }
return ( return (
<> <>
<div className="layout-wrapper"> <div className="layout-wrapper">
@@ -141,7 +182,7 @@ export default function SignUp() {
name="firstname" name="firstname"
type="text" type="text"
iconName="people" iconName="people"
value={userDetails.firstname} value={userDetails.first_name}
inputHandler={handleInputChange} inputHandler={handleInputChange}
/> />
</div> </div>
@@ -152,7 +193,7 @@ export default function SignUp() {
name="lastname" name="lastname"
type="text" type="text"
iconName="people" iconName="people"
value={userDetails.lastname} value={userDetails.Last_name}
inputHandler={handleInputChange} inputHandler={handleInputChange}
/> />
</div> </div>
@@ -228,7 +269,9 @@ export default function SignUp() {
</div> </div>
</div> </div>
<div className="signin-area mb-1"> <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 <button
className="w-full rounded-[50px] mb-5 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"
// onClick={() => navigate("/verify-signup")} // onClick={() => navigate("/verify-signup")}
+6 -1
View File
@@ -1,8 +1,11 @@
import React from "react"; import React from "react";
import AuthLayout from "../../AuthPages/AuthLayout";
export default function ThankYou({ className }) { export default function ThankYou({ className }) {
return ( return (
<div <>
<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={`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 || "" className || ""
}`} }`}
@@ -44,5 +47,7 @@ export default function ThankYou({ className }) {
</a> </a>
</div> </div>
</div> </div>
</AuthLayout>
</>
); );
} }
@@ -1,17 +1,87 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import titleShape from "../../../assets/images/shape/title-shape-two.svg"; import titleShape from "../../../assets/images/shape/title-shape-two.svg";
import InputCom from "../../Helpers/Inputs/InputCom"; import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout"; import AuthLayout from "../AuthLayout";
import ThankYou from "../ThankYou"; import ThankYou from "../ThankYou";
import usersService from "../../../services/UsersService";
export default function UpdatePassword() { export default function UpdatePassword() {
const [updated, setValue] = useState(false); const [values, setValues] = useState({
password: '',
confirmPassword: '',
})
const [message, setMessage] = useState(false); const [message, setMessage] = useState(false);
const updatePassword = () => { const [validation, setValidation] = useState("");
setValue(!updated); const [loading, setLoading] = useState(false);
setTimeout(() => { const updatePass = new usersService()
setMessage(!message); const navigate = useNavigate()
}, 100);
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")
}
}; };
return ( return (
@@ -19,7 +89,6 @@ export default function UpdatePassword() {
<AuthLayout <AuthLayout
slogan="Welcome to myFit" 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 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>
<div className="title-area relative flex flex-col justify-center items-center mb-7"> <div className="title-area relative flex flex-col justify-center items-center mb-7">
@@ -32,7 +101,7 @@ export default function UpdatePassword() {
</div> </div>
</div> </div>
<div className="input-area"> <div className="input-area">
<div className="input-item mb-5"> {/* <div className="input-item mb-5">
<InputCom <InputCom
placeholder="*********" placeholder="*********"
label="Old Password" label="Old Password"
@@ -40,7 +109,7 @@ export default function UpdatePassword() {
type="password" type="password"
iconName="password" iconName="password"
/> />
</div> </div> */}
<div className="input-item mb-5"> <div className="input-item mb-5">
<InputCom <InputCom
placeholder="*********" placeholder="*********"
@@ -48,32 +117,35 @@ export default function UpdatePassword() {
name="password" name="password"
type="password" type="password"
iconName="password" iconName="password"
inputHandler={onChange}
/> />
</div> </div>
<div className="input-item mb-5"> <div className="input-item mb-5">
<InputCom <InputCom
placeholder="*********" placeholder="*********"
label="Re-enter Password" label="Re-enter Password"
name="password" name="confirmPassword"
type="password" type="password"
iconName="password" iconName="password"
inputHandler={onChange}
/> />
</div> </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"> <div className="signin-area mb-3.5">
<button <button
onClick={updatePassword} onClick={updatePassword}
type="button" type="button"
className="w-full rounded-[50px] mb-5 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"
> >
Continue {loading ? <div className="signup btn-loader"></div> : <span>Continue</span>}
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
) : ( {/* // : (
<ThankYou className={`thankyou-section ${message ? "active" : ""}`} /> // <ThankYou className={`thankyou-section ${message ? "active" : ""}`} />
)} // )} */}
</AuthLayout> </AuthLayout>
</> </>
); );
+33 -7
View File
@@ -1,18 +1,26 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
export default function Otp() { export default function Otp({handleChange, value}) {
useEffect(() => { useEffect(() => {
const otp = document.querySelector("#otp-inputs"); const otp = document.querySelector("#otp-inputs");
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
for (const pin of otp.children) { for (const pin of otp.children) {
// eslint-disable-next-line no-loop-func // eslint-disable-next-line no-loop-func
pin.onkeyup = () => { pin.onkeyup = (value) => {
if (pin.nextSibling) { if(pin.children){
pin.nextSibling.children.otp.focus(); 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();
}
} }
}; };
} }
}); }, []);
return ( return (
<> <>
<div <div
@@ -25,6 +33,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_one'
value={value.value_one}
onChange={handleChange}
/> />
</div> </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 "> <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 ">
@@ -33,6 +44,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_two'
value={value.value_two}
onChange={handleChange}
/> />
</div> </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 "> <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 ">
@@ -41,6 +55,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_three'
value={value.value_three}
onChange={handleChange}
/> />
</div> </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 "> <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 ">
@@ -49,6 +66,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_four'
value={value.value_four}
onChange={handleChange}
/> />
</div> </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 "> <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 ">
@@ -57,6 +77,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_five'
value={value.value_five}
onChange={handleChange}
/> />
</div> </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 "> <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 ">
@@ -65,6 +88,9 @@ export default function Otp() {
type="text" type="text"
maxLength={1} maxLength={1}
id="otp" id="otp"
name='value_six'
value={value.value_six}
onChange={handleChange}
/> />
</div> </div>
</div> </div>
+89 -6
View File
@@ -1,9 +1,90 @@
import React from "react"; import React,{useState} from "react";
import {useNavigate} from "react-router-dom"
import titleShape from "../../../assets/images/shape/text-shape-three.svg"; import titleShape from "../../../assets/images/shape/text-shape-three.svg";
import AuthLayout from "../AuthLayout"; import AuthLayout from "../AuthLayout";
import Otp from "./Otp"; import Otp from "./Otp";
import usersService from "../../../services/UsersService";
export default function VerifyYou() { 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 ( return (
<> <>
<AuthLayout <AuthLayout
@@ -20,20 +101,22 @@ export default function VerifyYou() {
</div> </div>
</div> </div>
<div className="input-area"> <div className="input-area">
<Otp /> <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>}
<div className="signin-area mb-3.5"> <div className="signin-area mb-3.5">
<a <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" className="w-full rounded-[50px] h-[58px] mb-6 text-xl text-white font-bold flex justify-center bg-purple items-center"
onClick={handleSubmit}
> >
Continue {loading ? <div className="signup btn-loader"></div> : <span>Continue</span>}
</a> </a>
</div> </div>
<div className="resend-code flex justify-center"> <div className="resend-code flex justify-center">
<p className="text-lg text-thin-light-gray font-normal"> <p className="text-lg text-thin-light-gray font-normal">
Dontt have an aceount ? Dontt have an aceount ?
<a href="#" className="ml-2 text-dark-gray dark:text-white font-bold"> <a href="/signup" className="ml-2 text-dark-gray dark:text-white font-bold">
Please resend Sign Up
</a> </a>
</p> </p>
</div> </div>
+1 -2
View File
@@ -76,8 +76,7 @@ export default function TrackItemCard({ datas, hidden = false }) {
</div> </div>
</div> </div>
{/* user */} {/* user */}
<div className="user w-full text-center"> <div className="user w-full text-center mt-[14px]">
<p className="text-sm text-thin-light-gray dark:text-white"> <p className="text-sm text-thin-light-gray dark:text-white">
<Link <Link
to={`/track-action/${datas.widget}`} to={`/track-action/${datas.widget}`}
+1 -1
View File
@@ -76,7 +76,7 @@ export default function AddEditReminder({ className }) {
setMessage({status: true, message: ''}) setMessage({status: true, message: ''})
let {description, notes, category, mode} = infoDetail let {description, notes, category, mode} = infoDetail
//CHECKING IF AN EMPTY FIELD WAS PASSED //CHECKING IF AN EMPTY FIELD WAS PASSED
if(!description || !notes || !category || !mode){ if(!description || !category || !mode){
setSuccess(false) setSuccess(false)
setMessage({status: false, message: 'All fields must be filled'}) setMessage({status: false, message: 'All fields must be filled'})
return return
+8
View File
@@ -669,6 +669,7 @@ TODO: Responsive ===========================
.nft-userprofile-wrapper .content-wrapper-profile-only .auth { .nft-userprofile-wrapper .content-wrapper-profile-only .auth {
margin-top: -70px; margin-top: -70px;
} }
.react-date-picker__calendar {width: 290px;}
} }
@media (max-width: 376px) { @media (max-width: 376px) {
.notification-page .content-item .notifications { .notification-page .content-item .notifications {
@@ -677,6 +678,7 @@ TODO: Responsive ===========================
.notification-page .content-item .notifications .icon { .notification-page .content-item .notifications .icon {
@apply mb-2; @apply mb-2;
} }
} }
/* Calendar */ /* Calendar */
@@ -766,6 +768,11 @@ TODO: Responsive ===========================
} }
/* Date Picker */ /* Date Picker */
.react-date-picker{
display: flex !important;
flex: 1;
}
.react-date-picker__wrapper{ .react-date-picker__wrapper{
border: 0.5px solid #E3E4FE; border: 0.5px solid #E3E4FE;
padding: 1.25rem; padding: 1.25rem;
@@ -783,6 +790,7 @@ TODO: Responsive ===========================
.dark .react-date-picker__button svg{stroke: #7B818D;} .dark .react-date-picker__button svg{stroke: #7B818D;}
.react-date-picker__calendar {inset: 100% 25px auto auto !important;}
.react-date-picker__calendar .react-calendar{ .react-date-picker__calendar .react-calendar{
min-height: 18.4rem; min-height: 18.4rem;
} }
+7 -7
View File
@@ -5,6 +5,11 @@ class usersService {
console.log("Er are here anyway"); console.log("Er are here anyway");
} }
// Reset Password
resetPassword(reqData) {
return this.postAuxEnd('/resetpass', reqData);
}
logInUser(reqData) { logInUser(reqData) {
localStorage.setItem("session_token", ``); localStorage.setItem("session_token", ``);
return this.postAuxEnd("/login", reqData); return this.postAuxEnd("/login", reqData);
@@ -16,15 +21,10 @@ class usersService {
} }
//SIGNUP AUTH //SIGNUP AUTH
signupAuth(reqData){ signupUser(reqData){
return this.postAuxEnd("/account", reqData); return this.postAuxEnd("/account", reqData);
} }
//SIGNUP OTP VERIFICATION AUTH
signupOTPVerify(reqData){
return this.postAuxEnd("/signup-code", reqData);
}
getUserReminders(){ getUserReminders(){
var reqData = { var reqData = {
member_id: localStorage.getItem("member_id") member_id: localStorage.getItem("member_id")
@@ -133,7 +133,7 @@ class usersService {
if (error.response) { if (error.response) {
//response status is an error code //response status is an error code
console.log("ERROR-------------------------------------------------------"); console.log("ERROR-------------------------------------------------------");
console.log(error.response.status); console.log(error.response.status, 'err');
console.log("ERROR-------------------------------------------------------"); console.log("ERROR-------------------------------------------------------");
} else if (error.request) { } else if (error.request) {
//response not received though the request was sent //response not received though the request was sent
+6
View File
@@ -0,0 +1,6 @@
import React from "react";
import CompleteSignUp from "../components/AuthPages/SignUp/CompleteSignUp";
export default function VerifySignupCompletePage() {
return <CompleteSignUp />;
}