Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f045ebcfe4 | |||
| c49cc64196 | |||
| 6a266ff772 | |||
| 4fcd3104df | |||
| bfc956137f | |||
| b4ddd86bc2 | |||
| f41a9961ae | |||
| 9376f96543 | |||
| 500c54d442 | |||
| 85bd79a612 | |||
| c17f95351f | |||
| 1be78e7484 | |||
| 9103a812b5 | |||
| 7dc8503861 | |||
| a819bcca1f | |||
| 161bac928b | |||
| 40834b9c38 | |||
| 7a823fcf74 | |||
| faa4fdf8a6 | |||
| a33d405c8c | |||
| 56570fbd33 | |||
| 2d657165bd | |||
| 7daf939239 | |||
| 8355b291c9 | |||
| 7a5becdaed | |||
| 1fb997db0a | |||
| 69edd5cac0 | |||
| 11d55b1f10 |
@@ -2,7 +2,7 @@ PUBLIC_URL=http://localhost:3000/
|
||||
PORT=3000
|
||||
PRIMARY_APP_API_URL=https://preview.keenthemes.com/metronic8/laravel/api
|
||||
REACT_APP_BASE_LAYOUT_CONFIG_KEY='metronic-react-demo1-8150'
|
||||
REACT_APP_API_URL=https://preview.keenthemes.com/metronic8/laravel/api
|
||||
REACT_APP_API_URL=https://float-gat.dev.chiefsoft.net/en/userweb/api/v1
|
||||
REACT_APP_VERSION=v8.1.5
|
||||
REACT_APP_THEME_NAME=WrenchBoard
|
||||
REACT_APP_THEME_DEMO=dashboard
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
<div id="root"></div>
|
||||
<div id="splash-screen" class="splash-screen">
|
||||
<img src="%PUBLIC_URL%/media/logos/default-small.svg" alt="WrenchBoard" />
|
||||
<img src="%PUBLIC_URL%/media/logos/favicon.ico" alt="Float Users" />
|
||||
<span>Loading ...</span>
|
||||
</div>
|
||||
<div id="root-modals"></div>
|
||||
|
||||
@@ -22,19 +22,19 @@ const SidebarLogo = () => {
|
||||
{config.layoutType === 'dark-sidebar' ? (
|
||||
<img
|
||||
alt='Logo'
|
||||
src={toAbsoluteUrl('/media/logos/default-dark.svg')}
|
||||
src={toAbsoluteUrl('/media/logos/logo.png')}
|
||||
className='h-25px app-sidebar-logo-default'
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<img
|
||||
alt='Logo'
|
||||
src={toAbsoluteUrl('/media/logos/default.svg')}
|
||||
src={toAbsoluteUrl('/media/logos/logo.png')}
|
||||
className='h-25px app-sidebar-logo-default theme-light-show'
|
||||
/>
|
||||
<img
|
||||
alt='Logo'
|
||||
src={toAbsoluteUrl('/media/logos/default-dark.svg')}
|
||||
src={toAbsoluteUrl('/media/logos/logo.png')}
|
||||
className='h-25px app-sidebar-logo-default theme-dark-show'
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
.auth-height {
|
||||
min-height: 100vh;
|
||||
}
|
||||
@@ -12,4 +12,5 @@
|
||||
@import "header/header-sidebar-light";
|
||||
@import "content";
|
||||
@import "toolbar";
|
||||
@import "page-title";
|
||||
@import "page-title";
|
||||
@import "auth";
|
||||
@@ -60,59 +60,45 @@ const AuthLayout = () => {
|
||||
|
||||
{/* begin::Aside */}
|
||||
<div
|
||||
className='position-relative d-flex flex-lg-row-fluid w-lg-50 order-1 order-lg-2'
|
||||
// style={{backgroundImage: `url(${toAbsoluteUrl('/media/misc/auth-bg.png')})`}}
|
||||
style={{backgroundImage: `url(${toAbsoluteUrl('/media/misc/auth-bg-new.svg')})`, backgroundRepeat: 'no-repeat', backgroundSize: 'cover', backgroundPosition: 'left top'}}
|
||||
className='d-flex flex-lg-row-fluid w-lg-50 bgi-size-cover bgi-position-center order-1 order-lg-2'
|
||||
style={{backgroundImage: `url(${toAbsoluteUrl('/media/misc/auth-bg.png')})`}}
|
||||
>
|
||||
{/* overlay div section */}
|
||||
{/* <div className='position-absolute w-100 h-100 top-0 left-0' style={{backgroundColor: 'rgba(0, 0, 0, .4)', zIndex: '1'}}></div> */}
|
||||
{/* begin::Content */}
|
||||
<div className='position-relative d-flex flex-column flex-center py-15 px-5 px-md-15 w-100'>
|
||||
<div className='d-flex flex-column flex-center py-15 px-5 px-md-15 w-100'>
|
||||
{/* begin::Logo */}
|
||||
{/* <Link to='/' className='mb-12'>
|
||||
<Link to='/' className='mb-12'>
|
||||
<img alt='Float Mobility' src={toAbsoluteUrl('/media/logos/logo.png')} className='h-35px' />
|
||||
</Link> */}
|
||||
</Link>
|
||||
{/* end::Logo */}
|
||||
|
||||
{/* begin::Image */}
|
||||
{/* <img
|
||||
<img
|
||||
className='mx-auto w-275px w-md-50 w-xl-500px mb-10 mb-lg-20'
|
||||
src={toAbsoluteUrl('/media/misc/auth-screens.png')}
|
||||
alt=''
|
||||
/> */}
|
||||
{/* <img
|
||||
className='mx-auto w-350px w-md-50 w-xl-500px mb-10 mb-lg-20 rounded'
|
||||
src={toAbsoluteUrl('/media/misc/auth-bg-new.png')}
|
||||
alt=''
|
||||
style={{boxShadow: '0px 0px 10px white'}}
|
||||
/> */}
|
||||
/>
|
||||
{/* end::Image */}
|
||||
<div className='w-100 w-md-75 rounded p-3 p-lg-5' style={{backgroundColor: 'rgba(0, 0, 0, .8)', boxShadow: '0px 0px 10px white'}}>
|
||||
{/* begin::Title */}
|
||||
<h1 className='text-white fs-2qx fw-bolder text-center mb-7 py-3'>
|
||||
Fast, Efficient and Productive
|
||||
</h1>
|
||||
{/* end::Title */}
|
||||
|
||||
{/* begin::Text */}
|
||||
{/* <div className='text-white fs-base text-center'>
|
||||
In this kind of post,{' '}
|
||||
<a href='#' className='opacity-75-hover text-warning fw-bold me-1'>
|
||||
the blogger
|
||||
</a>
|
||||
introduces a person they’ve interviewed <br /> and provides some background information
|
||||
about
|
||||
<a href='#' className='opacity-75-hover text-warning fw-bold me-1'>
|
||||
the interviewee
|
||||
</a>
|
||||
and their <br /> work following this is a transcript of the interview.
|
||||
</div> */}
|
||||
<div className='text-white fs-base text-center py-3'>
|
||||
<p>Improve quality of life for the world's population by <a href='#' className='opacity-75-hover text-warning fw-bold me-1'>building</a> the future global transportation platform.</p>
|
||||
<p>Increasing accessibility and personal choices, <a href='#' className='opacity-75-hover text-warning fw-bold me-1'>while reducing</a> travel time traffic congestion, pollution, and loss to local GDP</p>
|
||||
</div>
|
||||
{/* end::Text */}
|
||||
{/* begin::Title */}
|
||||
<h1 className='text-white fs-2qx fw-bolder text-center mb-7'>
|
||||
Fast, Efficient and Productive
|
||||
</h1>
|
||||
{/* end::Title */}
|
||||
|
||||
{/* begin::Text */}
|
||||
<div className='text-white fs-base text-center'>
|
||||
In this kind of post,{' '}
|
||||
<a href='#' className='opacity-75-hover text-warning fw-bold me-1'>
|
||||
the blogger
|
||||
</a>
|
||||
introduces a person they’ve interviewed <br /> and provides some background information
|
||||
about
|
||||
<a href='#' className='opacity-75-hover text-warning fw-bold me-1'>
|
||||
the interviewee
|
||||
</a>
|
||||
and their <br /> work following this is a transcript of the interview.
|
||||
</div>
|
||||
{/* end::Text */}
|
||||
</div>
|
||||
{/* end::Content */}
|
||||
</div>
|
||||
|
||||
@@ -50,12 +50,13 @@ export function ForgotPassword() {
|
||||
id='kt_login_password_reset_form'
|
||||
onSubmit={formik.handleSubmit}
|
||||
>
|
||||
<div className='text-center mb-10'>
|
||||
{/* begin::Title */}
|
||||
{/* <h1 className='text-dark fw-bolder mb-3'>Forgot Password ?</h1> */}
|
||||
{/* begin::Heading */}
|
||||
<div className='text-center mb-11'>
|
||||
{/* <h1 className='text-dark fw-bolder mb-3'>Sign In</h1> */}
|
||||
<img alt='Float Mobility' src={toAbsoluteUrl('/media/logos/logo.png')} className='h-35px' />
|
||||
{/* end::Title */}
|
||||
|
||||
</div>
|
||||
{/* begin::Heading */}
|
||||
<div className='text-center mb-10'>
|
||||
{/* begin::Link */}
|
||||
<div className='text-gray-500 fw-semibold fs-6'>
|
||||
Enter your email to reset your password.
|
||||
|
||||
@@ -21,10 +21,10 @@ const loginSchema = Yup.object().shape({
|
||||
})
|
||||
|
||||
const initialValues = {
|
||||
email: 'admin@demo.com',
|
||||
password: 'demo',
|
||||
email: '',
|
||||
password: '',
|
||||
}
|
||||
|
||||
//email: 'admin@demo.com',
|
||||
/*
|
||||
Formik+YUP+Typescript:
|
||||
https://jaredpalmer.com/formik/docs/tutorial#getfieldprops
|
||||
@@ -39,12 +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)
|
||||
// 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)
|
||||
const {data: user} = await getUserByToken(auth.api_token)
|
||||
setCurrentUser(user)
|
||||
setCurrentUser(auth.profile)
|
||||
console.log(auth) //remove later
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
saveAuth(undefined)
|
||||
@@ -125,11 +135,6 @@ export function Login() {
|
||||
<div className='alert-text font-weight-bold'>{formik.status}</div>
|
||||
</div>
|
||||
) : (
|
||||
// <div className='mb-10 bg-light-info p-8 rounded'>
|
||||
// <div className='text-info'>
|
||||
// Any text before login box - please configure
|
||||
// </div>
|
||||
// </div>
|
||||
null
|
||||
)}
|
||||
|
||||
|
||||
@@ -88,15 +88,10 @@ export function Registration() {
|
||||
>
|
||||
{/* begin::Heading */}
|
||||
<div className='text-center mb-11'>
|
||||
{/* begin::Title */}
|
||||
{/* <h1 className='text-dark fw-bolder mb-3'>Sign Up</h1> */}
|
||||
{/* <h1 className='text-dark fw-bolder mb-3'>Sign In</h1> */}
|
||||
<img alt='Float Mobility' src={toAbsoluteUrl('/media/logos/logo.png')} className='h-35px' />
|
||||
{/* end::Title */}
|
||||
|
||||
{/* <div className='text-gray-500 fw-semibold fs-6'>Your Social Campaigns</div> */}
|
||||
</div>
|
||||
{/* end::Heading */}
|
||||
|
||||
{/* begin::Heading */}
|
||||
{/* begin::Login options */}
|
||||
<div className='row g-3 mb-9'>
|
||||
{/* begin::Col */}
|
||||
@@ -319,7 +314,7 @@ export function Registration() {
|
||||
<span>
|
||||
I Accept the{' '}
|
||||
<a
|
||||
href='https://keenthemes.com/metronic/?page=faq'
|
||||
href='#'
|
||||
target='_blank'
|
||||
className='ms-1 link-primary'
|
||||
>
|
||||
|
||||
@@ -69,9 +69,12 @@ const AuthInit: FC<WithChildren> = ({children}) => {
|
||||
const requestUser = async (apiToken: string) => {
|
||||
try {
|
||||
if (!didRequest.current) {
|
||||
const {data} = await getUserByToken(apiToken)
|
||||
if (data) {
|
||||
setCurrentUser(data)
|
||||
// const {data} = await getUserByToken(apiToken)
|
||||
// if (data) {
|
||||
// setCurrentUser(data)
|
||||
// }
|
||||
if (localStorage.getItem('kt-auth-react-v')) {
|
||||
setCurrentUser(auth.profile)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -86,8 +89,8 @@ const AuthInit: FC<WithChildren> = ({children}) => {
|
||||
return () => (didRequest.current = true)
|
||||
}
|
||||
|
||||
if (auth && auth.api_token) {
|
||||
requestUser(auth.api_token)
|
||||
if (auth && auth.session_token) {
|
||||
requestUser(auth.session_token)
|
||||
} else {
|
||||
logout()
|
||||
setShowSplashScreen(false)
|
||||
|
||||
@@ -52,8 +52,8 @@ export function setupAxios(axios: any) {
|
||||
axios.interceptors.request.use(
|
||||
(config: {headers: {Authorization: string}}) => {
|
||||
const auth = getAuth()
|
||||
if (auth && auth.api_token) {
|
||||
config.headers.Authorization = `Bearer ${auth.api_token}`
|
||||
if (auth && auth.session_token) {
|
||||
config.headers.Authorization = `Bearer ${auth.session_token}`
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export interface AuthModel {
|
||||
api_token: string
|
||||
session_token: string
|
||||
refreshToken?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`
|
||||
// Server should return AuthModel
|
||||
export function login(email: string, password: string) {
|
||||
return axios.post<AuthModel>(LOGIN_URL, {
|
||||
email,
|
||||
password,
|
||||
username: email,
|
||||
password: password,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export function requestPassword(email: string) {
|
||||
}
|
||||
|
||||
export function getUserByToken(token: string) {
|
||||
return axios.post<UserModel>(GET_USER_BY_ACCESSTOKEN_URL, {
|
||||
api_token: token,
|
||||
return axios.get<UserModel>(GET_USER_BY_ACCESSTOKEN_URL, {
|
||||
session_token: token,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user