Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dd99ec2d9 | |||
| 3ef3297dfc | |||
| be32be1ecd | |||
| 62fe0dabec | |||
| 77be53424a | |||
| da29fd3307 | |||
| 1a599cd582 | |||
| 7d612ef03a | |||
| 6254df4f2a | |||
| caf3eff237 | |||
| 0672cc88c3 |
@@ -31,6 +31,7 @@ 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,6 +52,7 @@ export default function Routers() {
|
||||
/>
|
||||
<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,34 +3,49 @@ 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("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)
|
||||
if (reset.status == 200){
|
||||
setTimeout(() => {
|
||||
navigate("/verify-you", {replace : true});
|
||||
setLoading(false)
|
||||
}, 2000);
|
||||
}else{
|
||||
setValidation('An error occurred')
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
validationChecker(email)
|
||||
}, [email])
|
||||
@@ -61,21 +76,21 @@ export default function ForgotPassword() {
|
||||
inputHandler={handleEmail}
|
||||
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 className="signin-area mb-3.5">
|
||||
|
||||
<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}
|
||||
onClick={() => navigate("/verify-you")}
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
Send Code
|
||||
{loading ? <div className="signup btn-loader"></div> : <span>Send Code</span>}
|
||||
</button>
|
||||
|
||||
<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
|
||||
</Link>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import React from "react";
|
||||
import AuthLayout from "../../AuthLayout";
|
||||
|
||||
export default function ThankYou({ className }) {
|
||||
|
||||
export default function CompleteSignUp({ 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 || ""
|
||||
@@ -44,5 +51,7 @@ export default function ThankYou({ className }) {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default function VerifyYou() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const verify = new usersService();
|
||||
const verifyOTP = new usersService();
|
||||
|
||||
const [loading, setLoading] = useState(false) // For loading spinner
|
||||
|
||||
@@ -45,12 +45,12 @@ export default function VerifyYou() {
|
||||
|
||||
setLoading(true) // Sets loading spinner
|
||||
|
||||
let code = '';
|
||||
let otpCode = '';
|
||||
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)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
@@ -58,7 +58,7 @@ export default function VerifyYou() {
|
||||
})
|
||||
return
|
||||
}
|
||||
if(code.length < 6){ // checks if verifiedCode is empty
|
||||
if(otpCode.length < 6){ // checks if verifiedCode is empty
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
@@ -67,8 +67,18 @@ export default function VerifyYou() {
|
||||
return
|
||||
}
|
||||
|
||||
let apiInput = {
|
||||
username: 'anumuduchukwuebuka@gmail.com',
|
||||
pend_uid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
|
||||
random_text: otpCode,
|
||||
mode: 'VERIFY',
|
||||
// loc: 'Desktop',
|
||||
// sessionid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
|
||||
// code: otpCode,
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await verify.signupOTPVerify(code);
|
||||
const res = await verifyOTP.signupOTPVerify(apiInput);
|
||||
console.log(res)
|
||||
if(res.status != 200){
|
||||
setLoading(false)
|
||||
@@ -85,7 +95,7 @@ export default function VerifyYou() {
|
||||
})
|
||||
setTimeout(()=>{
|
||||
setLoading(false)
|
||||
navigate('/update-password', { replace: true })
|
||||
navigate('/complete-signup', { replace: true })
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
|
||||
@@ -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";
|
||||
import usersService from "../../../services/UsersService"; // site api services
|
||||
|
||||
export default function SignUp() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const userSignupAuth = new usersService();
|
||||
const userSignup = new usersService();
|
||||
|
||||
const [loading, setLoading] = useState(false) // For loading spinner
|
||||
|
||||
@@ -62,6 +62,16 @@ 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)
|
||||
@@ -72,11 +82,25 @@ 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 userSignupAuth.signupAuth(userInfo);
|
||||
if(res.status != 200){
|
||||
const res = await userSignup.signupUser(userInfo);
|
||||
if(res.status != 200 || res.data.status < 1){
|
||||
setLoading(false)
|
||||
setErrorMessage({
|
||||
success: false,
|
||||
@@ -101,6 +125,7 @@ export default function SignUp() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="layout-wrapper">
|
||||
@@ -141,7 +166,7 @@ export default function SignUp() {
|
||||
name="firstname"
|
||||
type="text"
|
||||
iconName="people"
|
||||
value={userDetails.firstname}
|
||||
value={userDetails.first_name}
|
||||
inputHandler={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
@@ -152,7 +177,7 @@ export default function SignUp() {
|
||||
name="lastname"
|
||||
type="text"
|
||||
iconName="people"
|
||||
value={userDetails.lastname}
|
||||
value={userDetails.Last_name}
|
||||
inputHandler={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
@@ -228,7 +253,9 @@ 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")}
|
||||
|
||||
@@ -76,8 +76,7 @@ export default function TrackItemCard({ datas, hidden = false }) {
|
||||
</div>
|
||||
</div>
|
||||
{/* 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">
|
||||
<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 || !notes || !category || !mode){
|
||||
if(!description || !category || !mode){
|
||||
setSuccess(false)
|
||||
setMessage({status: false, message: 'All fields must be filled'})
|
||||
return
|
||||
|
||||
@@ -669,6 +669,7 @@ 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 {
|
||||
@@ -677,6 +678,7 @@ TODO: Responsive ===========================
|
||||
.notification-page .content-item .notifications .icon {
|
||||
@apply mb-2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Calendar */
|
||||
@@ -766,6 +768,11 @@ TODO: Responsive ===========================
|
||||
}
|
||||
|
||||
/* Date Picker */
|
||||
.react-date-picker{
|
||||
display: flex !important;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.react-date-picker__wrapper{
|
||||
border: 0.5px solid #E3E4FE;
|
||||
padding: 1.25rem;
|
||||
@@ -783,6 +790,7 @@ 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,6 +5,11 @@ 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);
|
||||
@@ -16,13 +21,13 @@ class usersService {
|
||||
}
|
||||
|
||||
//SIGNUP AUTH
|
||||
signupAuth(reqData){
|
||||
signupUser(reqData){
|
||||
return this.postAuxEnd("/account", reqData);
|
||||
}
|
||||
|
||||
//SIGNUP OTP VERIFICATION AUTH
|
||||
signupOTPVerify(reqData){
|
||||
return this.postAuxEnd("/signup-code", reqData);
|
||||
return this.postAuxEnd("/signup-code", reqData);
|
||||
}
|
||||
|
||||
getUserReminders(){
|
||||
@@ -133,7 +138,7 @@ class usersService {
|
||||
if (error.response) {
|
||||
//response status is an error code
|
||||
console.log("ERROR-------------------------------------------------------");
|
||||
console.log(error.response.status);
|
||||
console.log(error.response.status, 'err');
|
||||
console.log("ERROR-------------------------------------------------------");
|
||||
} else if (error.request) {
|
||||
//response not received though the request was sent
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import React from "react";
|
||||
import CompleteSignUp from "../components/AuthPages/SignUp/CompleteSignUp";
|
||||
|
||||
export default function VerifySignupCompletePage() {
|
||||
return <CompleteSignUp />;
|
||||
}
|
||||
Reference in New Issue
Block a user