From bfc956137f28f7350ed546b6240a420f4a9c6986 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sat, 15 Apr 2023 06:24:59 +0100 Subject: [PATCH 1/3] added right section --- src/app/modules/auth/AuthLayout.tsx | 102 +++++++++++++++------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/src/app/modules/auth/AuthLayout.tsx b/src/app/modules/auth/AuthLayout.tsx index 38b4544..25f9a5b 100644 --- a/src/app/modules/auth/AuthLayout.tsx +++ b/src/app/modules/auth/AuthLayout.tsx @@ -1,47 +1,10 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ -import {useEffect, useState} from 'react' +import {useEffect} from 'react' import {Outlet, Link} from 'react-router-dom' import {toAbsoluteUrl} from '../../../_res/helpers' const AuthLayout = () => { - //initial background color - let [bgColor, setBgColor] = useState({ - backgroundImage: 'linear-gradient(70deg, #E6E7F9, #b4caed)' - }) - - // function to determine background color - let changeBgColor = () => { - // let randomNum = Math.round(Math.random() * 3) - let randomNum = Number(localStorage.getItem('bg-num')) - if(randomNum){ - if(randomNum <= 1){ - setBgColor({ - backgroundImage: 'linear-gradient(70deg, #E6E7F9, #b4caed)' - }) - localStorage.setItem('bg-num', '2') - }else if(randomNum <= 2){ - setBgColor({ - backgroundImage: 'linear-gradient(70deg, #eee, #fff)' - }) - localStorage.setItem('bg-num', '3') - }else{ - setBgColor({ - backgroundImage: 'linear-gradient(70deg, #d5e1f5, #75a5f0)' - }) - localStorage.setItem('bg-num', '1') - } - }else{ - setBgColor({ - backgroundImage: 'linear-gradient(70deg, #E6E7F9, #b4caed)' - }) - localStorage.setItem('bg-num', '1') - } - } - useEffect(() => { - - changeBgColor() // calls the change color function after page loads - const root = document.getElementById('root') if (root) { root.style.height = '100%' @@ -54,17 +17,13 @@ const AuthLayout = () => { }, []) return ( -
+
{/* begin::Body */}
{/* begin::Form */}
-
- {/*

Sign In

*/} - Float Mobility -
{/* begin::Wrapper */} -
+
{/* end::Wrapper */} @@ -81,16 +40,16 @@ const AuthLayout = () => { - + Terms - - Contact Us + + Plans - - About Us + + Contact Us
{/* end::Links */} @@ -99,6 +58,51 @@ const AuthLayout = () => {
{/* end::Body */} + {/* begin::Aside */} +
+ {/* begin::Content */} +
+ {/* begin::Logo */} + + Float Mobility + + {/* end::Logo */} + + {/* begin::Image */} + + {/* end::Image */} + + {/* begin::Title */} +

+ Fast, Efficient and Productive +

+ {/* end::Title */} + + {/* begin::Text */} +
+ In this kind of post,{' '} + + the blogger + + introduces a person they’ve interviewed
and provides some background information + about + + the interviewee + + and their
work following this is a transcript of the interview. +
+ {/* end::Text */} +
+ {/* end::Content */} +
+ {/* end::Aside */}
) } From 4fcd3104df1ffbda743b6de7a3ee8bf6721496da Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sat, 15 Apr 2023 07:29:03 +0100 Subject: [PATCH 2/3] login layout reverted and login function cleaned up --- .../auth/components/ForgotPassword.tsx | 6 ++++++ src/app/modules/auth/components/Login.tsx | 20 ++++++++++++++----- .../modules/auth/components/Registration.tsx | 7 ++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/app/modules/auth/components/ForgotPassword.tsx b/src/app/modules/auth/components/ForgotPassword.tsx index 4bb8dce..3945f93 100644 --- a/src/app/modules/auth/components/ForgotPassword.tsx +++ b/src/app/modules/auth/components/ForgotPassword.tsx @@ -50,6 +50,12 @@ export function ForgotPassword() { id='kt_login_password_reset_form' onSubmit={formik.handleSubmit} > + {/* begin::Heading */} +
+ {/*

Sign In

*/} + Float Mobility +
+ {/* begin::Heading */}
{/* begin::Link */}
diff --git a/src/app/modules/auth/components/Login.tsx b/src/app/modules/auth/components/Login.tsx index 16b701c..ff2e053 100644 --- a/src/app/modules/auth/components/Login.tsx +++ b/src/app/modules/auth/components/Login.tsx @@ -8,8 +8,6 @@ import {getUserByToken, login} from '../core/_requests' import {toAbsoluteUrl} from '../../../../_metronic/helpers' import {useAuth} from '../core/Auth' -import {useNavigate} from 'react-router-dom' - const loginSchema = Yup.object().shape({ email: Yup.string() .email('Wrong email format') @@ -34,7 +32,6 @@ const initialValues = { */ export function Login() { - const navigate = useNavigate() const [loading, setLoading] = useState(false) const {saveAuth, setCurrentUser} = useAuth() @@ -42,14 +39,22 @@ export function Login() { initialValues, validationSchema: loginSchema, onSubmit: async (values, {setStatus, setSubmitting}) => { + setStatus('') setLoading(true) try { const {data: auth} = await login(values.email, values.password) - saveAuth(auth) // const {data: user} = await getUserByToken(auth.session_token) // setCurrentUser(user) + if(auth.status <= 0){ // checking if request is not successful + setStatus('The login details are incorrect') + setSubmitting(false) + setLoading(false) + console.log(auth) //remove later + return + } + saveAuth(auth) setCurrentUser(auth.profile) - navigate('/dashboard') + console.log(auth) //remove later } catch (error) { console.error(error) saveAuth(undefined) @@ -68,6 +73,11 @@ export function Login() { id='kt_login_signin_form' > {/* begin::Heading */} +
+ {/*

Sign In

*/} + Float Mobility +
+ {/* begin::Heading */} {/* begin::Login options */}
diff --git a/src/app/modules/auth/components/Registration.tsx b/src/app/modules/auth/components/Registration.tsx index 1f50932..715433b 100644 --- a/src/app/modules/auth/components/Registration.tsx +++ b/src/app/modules/auth/components/Registration.tsx @@ -86,7 +86,12 @@ export function Registration() { id='kt_login_signup_form' onSubmit={formik.handleSubmit} > - + {/* begin::Heading */} +
+ {/*

Sign In

*/} + Float Mobility +
+ {/* begin::Heading */} {/* begin::Login options */}
{/* begin::Col */} From 6a266ff772d26b3f442f773eec38a52b0027d459 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sat, 15 Apr 2023 10:44:45 +0100 Subject: [PATCH 3/3] anchor links added --- src/app/modules/auth/AuthLayout.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/modules/auth/AuthLayout.tsx b/src/app/modules/auth/AuthLayout.tsx index 25f9a5b..7403f24 100644 --- a/src/app/modules/auth/AuthLayout.tsx +++ b/src/app/modules/auth/AuthLayout.tsx @@ -40,16 +40,16 @@ const AuthLayout = () => { - + Terms - - Plans + + Contact Us - - Contact Us + + About Us
{/* end::Links */}