Compare commits

..

1 Commits

Author SHA1 Message Date
victorAnumudu c130c056f8 signup verify code bug fix 2023-03-02 09:37:35 +01:00
5 changed files with 59 additions and 41 deletions
@@ -1,5 +1,4 @@
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";
@@ -68,18 +67,14 @@ export default function VerifyYou() {
}
let apiInput = {
username: 'anumuduchukwuebuka@gmail.com',
pend_uid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
username: localStorage.getItem('username'),
pend_uid: localStorage.getItem('uuid'),
random_text: otpCode,
mode: 'VERIFY',
// loc: 'Desktop',
// sessionid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
// code: otpCode,
}
try {
const res = await verifyOTP.signupOTPVerify(apiInput);
console.log(res)
const res = await verifyOTP.signupUser(apiInput)
if(res.status != 200){
setLoading(false)
setErrorMessage({
@@ -88,15 +83,33 @@ export default function VerifyYou() {
})
return
}
// if status code is 200 proceed
setErrorMessage({
success: true,
message: 'verification successfully'
})
setTimeout(()=>{
setLoading(false)
navigate('/complete-signup', { replace: true })
}, 1000)
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)
}
} catch (error) {
setLoading(false)
setErrorMessage({
+28 -10
View File
@@ -62,6 +62,8 @@ 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) {
@@ -100,7 +102,7 @@ export default function SignUp() {
try {
const res = await userSignup.signupUser(userInfo);
if(res.status != 200 || res.data.status < 1){
if(res.status != 200){
setLoading(false)
setErrorMessage({
success: false,
@@ -108,15 +110,31 @@ export default function SignUp() {
})
return
}
// if status code is 200 proceed
setErrorMessage({
success: true,
message: 'Account created successfully'
})
setTimeout(()=>{
setLoading(false)
navigate("/verify-signup", { replace: true })
}, 1000)
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)
}
} catch (error) {
setLoading(false)
setErrorMessage({
+1 -1
View File
@@ -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
-8
View File
@@ -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
View File
@@ -25,11 +25,6 @@ class usersService {
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")