27112023
This commit is contained in:
4
.env
4
.env
@@ -26,4 +26,6 @@ REACT_APP_AWS_APP_CLIENT_ID=
|
||||
## Auth0
|
||||
|
||||
REACT_APP_AUTH0_CLIENT_ID=
|
||||
REACT_APP_AUTH0_DOMAIN=
|
||||
REACT_APP_AUTH0_DOMAIN=
|
||||
|
||||
DISABLE_ESLINT_PLUGIN=true
|
||||
|
||||
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -1,16 +0,0 @@
|
||||
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.63954 13.3644L3.95187 11.052L3.95428 11.0496H8.30453L6.5736 12.7806L6.12669 13.2275L4.35415 15L4.57368 15.2201L14.5039 25.1498L24.6537 15L22.8805 13.2275L22.7557 13.102L20.7033 11.0496H25.0535L25.0559 11.052L26.8683 12.8644L29.0039 15L14.5039 29.5L0.00390625 15L1.63954 13.3644ZM14.5039 0.5L22.8823 8.87842H18.5321L14.5039 4.85024L10.4757 8.87842H6.12548L14.5039 0.5Z" fill="#096DD9"/>
|
||||
<path d="M4.35477 15.0002L6.12731 13.2276L6.57422 12.7807L4.84389 11.0498H3.9549L3.95249 11.0522L1.64016 13.3645L3.85961 15.5731L4.35477 15.0002Z" fill="url(#paint0_linear_112102_1824)"/>
|
||||
<path d="M22.8814 13.2276L24.6545 15.0002L24.479 15.1757L24.4796 15.1763L26.8691 12.8646L25.0568 11.0522L25.0544 11.0498H24.8783L22.7565 13.1022L22.8814 13.2276Z" fill="url(#paint1_linear_112102_1824)"/>
|
||||
<path d="M3.9497 11.0498L3.95211 11.0522L6.12693 13.2276L14.5041 21.6043L25.0586 11.0498H3.9497Z" fill="#1890FF"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_112102_1824" x1="5.62978" y1="11.5889" x2="2.57161" y2="14.6471" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#023B95"/>
|
||||
<stop offset="0.9637" stop-color="#096CD9" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_112102_1824" x1="23.2722" y1="11.6281" x2="25.7451" y2="14.4382" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#023B95"/>
|
||||
<stop offset="1" stop-color="#096DD9" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.svg" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
@@ -17,7 +17,7 @@
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>Mantis React Admin Dashboard</title>
|
||||
<title>Nearle Express</title>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<link
|
||||
|
||||
25
src/App.js
25
src/App.js
@@ -6,29 +6,40 @@ import Locales from 'components/Locales';
|
||||
import ScrollTop from 'components/ScrollTop';
|
||||
import Snackbar from 'components/@extended/Snackbar';
|
||||
import Notistack from 'components/third-party/Notistack';
|
||||
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useEffect } from 'react';
|
||||
// auth-provider
|
||||
import { JWTProvider as AuthProvider } from 'contexts/JWTContext';
|
||||
// import { JWTProvider as AuthProvider } from 'contexts/JWTContext';
|
||||
|
||||
// ==============================|| APP - THEME, ROUTER, LOCAL ||============================== //
|
||||
|
||||
const App = () => (
|
||||
const App = () =>{
|
||||
let navigate=useNavigate()
|
||||
|
||||
// useEffect(()=>{
|
||||
// if (!localStorage.getItem("firstname")) {
|
||||
// navigate('/login')
|
||||
// }
|
||||
// },[])
|
||||
|
||||
|
||||
return <>
|
||||
<ThemeCustomization>
|
||||
{/* <RTLLayout> */}
|
||||
<Locales>
|
||||
<ScrollTop>
|
||||
<AuthProvider>
|
||||
{/* <AuthProvider> */}
|
||||
<>
|
||||
<Notistack>
|
||||
<Routes />
|
||||
<Snackbar />
|
||||
</Notistack>
|
||||
</>
|
||||
</AuthProvider>
|
||||
{/* </AuthProvider> */}
|
||||
</ScrollTop>
|
||||
</Locales>
|
||||
{/* </RTLLayout> */}
|
||||
</ThemeCustomization>
|
||||
);
|
||||
|
||||
</>
|
||||
}
|
||||
export default App;
|
||||
|
||||
BIN
src/assets/images/logo-nearle.png
Normal file
BIN
src/assets/images/logo-nearle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
src/assets/images/logo-sm.png
Normal file
BIN
src/assets/images/logo-sm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -20,6 +20,7 @@ const initialState = {
|
||||
isLoggedIn: false,
|
||||
isInitialized: false,
|
||||
user: null
|
||||
|
||||
};
|
||||
|
||||
const verifyToken = (serviceToken) => {
|
||||
@@ -52,30 +53,31 @@ export const JWTProvider = ({ children }) => {
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
try {
|
||||
const serviceToken = window.localStorage.getItem('serviceToken');
|
||||
if (serviceToken && verifyToken(serviceToken)) {
|
||||
setSession(serviceToken);
|
||||
const response = await axios.get('/api/account/me');
|
||||
const { user } = response.data;
|
||||
dispatch({
|
||||
type: LOGIN,
|
||||
payload: {
|
||||
isLoggedIn: true,
|
||||
user
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: LOGOUT
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
dispatch({
|
||||
type: LOGOUT
|
||||
});
|
||||
}
|
||||
console.log(verifyToken)
|
||||
// try {
|
||||
// const serviceToken = window.localStorage.getItem('serviceToken');
|
||||
// if (serviceToken && verifyToken(serviceToken)) {
|
||||
// setSession(serviceToken);
|
||||
// const response = await axios.get('/api/account/me');
|
||||
// const { user } = response.data;
|
||||
// dispatch({
|
||||
// type: LOGIN,
|
||||
// payload: {
|
||||
// isLoggedIn: true,
|
||||
// user
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// dispatch({
|
||||
// type: LOGOUT
|
||||
// });
|
||||
// }
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// dispatch({
|
||||
// type: LOGOUT
|
||||
// });
|
||||
// }
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
@@ -26,7 +26,7 @@ const DrawerContent = () => {
|
||||
}}
|
||||
>
|
||||
<Navigation />
|
||||
{drawerOpen && !matchDownMD && <NavCard />}
|
||||
{/* {drawerOpen && !matchDownMD && <NavCard />} */}
|
||||
</SimpleBar>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,6 +11,8 @@ import Logo from 'components/logo';
|
||||
import { MenuOrientation } from 'config';
|
||||
import useConfig from 'hooks/useConfig';
|
||||
|
||||
import logo from 'assets/images/logo-nearle.png'
|
||||
import logo1 from 'assets/images/logo-sm.png'
|
||||
// ==============================|| DRAWER HEADER ||============================== //
|
||||
|
||||
const DrawerHeader = ({ open }) => {
|
||||
@@ -32,7 +34,14 @@ const DrawerHeader = ({ open }) => {
|
||||
paddingLeft: isHorizontal ? { xs: '24px', lg: '0' } : open ? '24px' : 0
|
||||
}}
|
||||
>
|
||||
<Logo isIcon={!open} sx={{ width: open ? 'auto' : 35, height: 35 }} />
|
||||
{/* <Logo isIcon={!open} sx={{ width: open ? 'auto' : 35, height: 35 }} /> */}
|
||||
|
||||
{(open) &&
|
||||
<img src={logo} width='160px' height='45px' alt='logo'/>
|
||||
}
|
||||
{(!open) &&
|
||||
<img src={logo1} width='40px' alt='logo'/>
|
||||
}
|
||||
</DrawerHeaderStyled>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6,11 +6,13 @@ import { List, ListItemButton, ListItemIcon, ListItemText } from '@mui/material'
|
||||
|
||||
// assets
|
||||
import { EditOutlined, ProfileOutlined, LogoutOutlined, UserOutlined, WalletOutlined } from '@ant-design/icons';
|
||||
import { useNavigate } from 'react-router';
|
||||
|
||||
// ==============================|| HEADER PROFILE - PROFILE TAB ||============================== //
|
||||
|
||||
const ProfileTab = ({ handleLogout }) => {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const navigate=useNavigate();
|
||||
const handleListItemClick = (event, index) => {
|
||||
setSelectedIndex(index);
|
||||
};
|
||||
@@ -42,7 +44,12 @@ const ProfileTab = ({ handleLogout }) => {
|
||||
</ListItemIcon>
|
||||
<ListItemText primary="Billing" />
|
||||
</ListItemButton>
|
||||
<ListItemButton selected={selectedIndex === 2} onClick={handleLogout}>
|
||||
<ListItemButton selected={selectedIndex === 2}
|
||||
// onClick={handleLogout}
|
||||
onClick={()=>{
|
||||
navigate('/login')
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<LogoutOutlined />
|
||||
</ListItemIcon>
|
||||
|
||||
@@ -15,7 +15,7 @@ import Transitions from 'components/@extended/Transitions';
|
||||
import IconButton from 'components/@extended/IconButton';
|
||||
|
||||
import { ThemeMode } from 'config';
|
||||
import useAuth from 'hooks/useAuth';
|
||||
// import useAuth from 'hooks/useAuth';
|
||||
|
||||
// assets
|
||||
import avatar1 from 'assets/images/users/avatar-1.png';
|
||||
@@ -49,7 +49,7 @@ const Profile = () => {
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { logout, user } = useAuth();
|
||||
// const { logout, user } = useAuth();
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
await logout();
|
||||
@@ -105,7 +105,9 @@ const Profile = () => {
|
||||
>
|
||||
<Stack direction="row" spacing={2} alignItems="center" sx={{ p: 0.5 }}>
|
||||
<Avatar alt="profile user" src={avatar1} size="xs" />
|
||||
<Typography variant="subtitle1">{user?.name}</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
{/* {user?.name} */}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</ButtonBase>
|
||||
<Popper
|
||||
@@ -147,7 +149,9 @@ const Profile = () => {
|
||||
<Stack direction="row" spacing={1.25} alignItems="center">
|
||||
<Avatar alt="profile user" src={avatar1} sx={{ width: 32, height: 32 }} />
|
||||
<Stack>
|
||||
<Typography variant="h6">{user?.name}</Typography>
|
||||
<Typography variant="h6">
|
||||
{/* {user?.name} */}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="textSecondary">
|
||||
UI/UX Designer
|
||||
</Typography>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMemo } from 'react';
|
||||
|
||||
// material-ui
|
||||
import { Box, useMediaQuery } from '@mui/material';
|
||||
import { Box, useMediaQuery ,Stack} from '@mui/material';
|
||||
|
||||
// project import
|
||||
import Search from './Search';
|
||||
@@ -21,7 +21,10 @@ const HeaderContent = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{!matchesXs && <Search />}
|
||||
{/* {!matchesXs && <Search />} */}
|
||||
<Stack
|
||||
width='100%'
|
||||
direction='row' justifyContent='flex-end' spacing={2} alignItems='center'>
|
||||
{!matchesXs && megaMenu}
|
||||
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
|
||||
|
||||
@@ -29,6 +32,7 @@ const HeaderContent = () => {
|
||||
<Message />
|
||||
{!matchesXs && <Profile />}
|
||||
{matchesXs && <MobileSection />}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -35,35 +35,35 @@ const other = {
|
||||
type: 'group',
|
||||
children: [
|
||||
{
|
||||
id: 'sample-page',
|
||||
title: <FormattedMessage id="sample-page" />,
|
||||
id: 'dashboard',
|
||||
title: <FormattedMessage id="Dashboard" />,
|
||||
type: 'item',
|
||||
url: '/sample-page',
|
||||
url: '/dashboard',
|
||||
icon: icons.ChromeOutlined
|
||||
},
|
||||
{
|
||||
id: 'documentation',
|
||||
title: <FormattedMessage id="documentation" />,
|
||||
type: 'item',
|
||||
url: 'https://links.codedthemes.com/BQFrl',
|
||||
icon: icons.QuestionOutlined,
|
||||
external: true,
|
||||
target: true,
|
||||
chip: {
|
||||
label: 'gitbook',
|
||||
color: 'secondary',
|
||||
size: 'small'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'roadmap',
|
||||
title: <FormattedMessage id="roadmap" />,
|
||||
type: 'item',
|
||||
url: 'https://links.codedthemes.com/RXnKQ',
|
||||
icon: icons.DeploymentUnitOutlined,
|
||||
external: true,
|
||||
target: true
|
||||
}
|
||||
// {
|
||||
// id: 'documentation',
|
||||
// title: <FormattedMessage id="documentation" />,
|
||||
// type: 'item',
|
||||
// url: 'https://links.codedthemes.com/BQFrl',
|
||||
// icon: icons.QuestionOutlined,
|
||||
// external: true,
|
||||
// target: true,
|
||||
// chip: {
|
||||
// label: 'gitbook',
|
||||
// color: 'secondary',
|
||||
// size: 'small'
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'roadmap',
|
||||
// title: <FormattedMessage id="roadmap" />,
|
||||
// type: 'item',
|
||||
// url: 'https://links.codedthemes.com/RXnKQ',
|
||||
// icon: icons.DeploymentUnitOutlined,
|
||||
// external: true,
|
||||
// target: true
|
||||
// }
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
10
src/pages/nearle/dashboard.js
Normal file
10
src/pages/nearle/dashboard.js
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
const Dashboard=()=>{
|
||||
|
||||
return <>
|
||||
<h1>Dashboard</h1>
|
||||
</>
|
||||
}
|
||||
|
||||
export default Dashboard;
|
||||
494
src/pages/nearle/login.js
Normal file
494
src/pages/nearle/login.js
Normal file
@@ -0,0 +1,494 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
// import { useSelector } from 'react-redux';
|
||||
// import AuthWrapper from 'sections/auth/AuthWrapper';
|
||||
import {
|
||||
Box, Grid, Card,
|
||||
CardContent,
|
||||
// CardHeader,
|
||||
Stack,
|
||||
// Divider,
|
||||
// InputLabel,
|
||||
// OutlinedInput,
|
||||
TextField,
|
||||
Button,
|
||||
Typography,
|
||||
CardHeader,
|
||||
Container,
|
||||
Link
|
||||
} from '@mui/material'
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import AnimateButton from 'components/@extended/AnimateButton';
|
||||
|
||||
|
||||
import logo from 'assets/images/logo-nearle.png'
|
||||
|
||||
import axios from 'axios'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
// import { openSnackbar } from 'store/reducers/snackbar';
|
||||
// import { useDispatch } from 'react-redux';
|
||||
import Loader from 'components/Loader';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
|
||||
const Login = () => {
|
||||
const theme = useTheme();
|
||||
const [username, setUsername] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [alertmessage, setAlertmessage] = useState('');
|
||||
const [checkusername, setCheckusername] = useState(false);
|
||||
// const [toast, setToast] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
let navigate = useNavigate();
|
||||
// let dispatch = useDispatch();
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
// let loginuserid = useSelector((state)=>state.logininfo);
|
||||
|
||||
// useEffect(() => {
|
||||
|
||||
// if (alertmessage) {
|
||||
// dispatch(
|
||||
// openSnackbar({
|
||||
// open: true,
|
||||
// message: alertmessage,
|
||||
// variant: 'alert',
|
||||
// anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||
// alert: {
|
||||
// // variant:'info',
|
||||
// color: 'error',
|
||||
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
// }
|
||||
// }, [toast])
|
||||
|
||||
useEffect(() => {
|
||||
if (localStorage.getItem("firstname") || localStorage.getItem("appuserid")) {
|
||||
navigate('/dashboard')
|
||||
}
|
||||
|
||||
console.log(alertmessage)
|
||||
}, [])
|
||||
|
||||
const usernamecheck = async (e) => {
|
||||
e.preventDefault();
|
||||
setUsername(e.target.value)
|
||||
if (e.target.value) {
|
||||
try {
|
||||
// await axios.post(`${process.env.REACT_APP_URL}/auth/login`, {
|
||||
// "authname": e.target.value
|
||||
// })
|
||||
await axios.post(`${process.env.REACT_APP_URL2}/users/login`, {
|
||||
"authname": e.target.value,
|
||||
"configid":3,
|
||||
// "password":'admi'
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
if (res.data.userinfo.authname === e.target.value) {
|
||||
|
||||
setUsername(e.target.value);
|
||||
setCheckusername(false);
|
||||
}
|
||||
// if (res.data.authname === e.target.value) {
|
||||
|
||||
// setUsername(e.target.value);
|
||||
// setCheckusername(false);
|
||||
// }
|
||||
}).catch((err) => {
|
||||
if (err.response.data.message === 'No user found') {
|
||||
|
||||
setCheckusername(true);
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const loginsend = async () => {
|
||||
// e.preventDefault();
|
||||
setLoading(true)
|
||||
|
||||
if (password && username) {
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await axios.post(`${process.env.REACT_APP_URL2}/users/login`, {
|
||||
"authname": username,
|
||||
"configid":3,
|
||||
"password": password
|
||||
}).then((res) => {
|
||||
console.log(res.data)
|
||||
if (res.data.userinfo.authname === username) {
|
||||
// setAlertmessage('login Successfull');
|
||||
setLoading(false)
|
||||
// dispatch(
|
||||
// openSnackbar({
|
||||
// open: true,
|
||||
// message: 'login Successfull',
|
||||
// variant: 'alert',
|
||||
// anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||
// alert: {
|
||||
// color: 'success'
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
enqueueSnackbar('login Successfull', {
|
||||
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||
autoHideDuration: 3000
|
||||
})
|
||||
setUsername('');
|
||||
setPassword('');
|
||||
localStorage.setItem("firstname", res.data.userinfo.firstname);
|
||||
localStorage.setItem("appuserid", res.data.userinfo.userid);
|
||||
localStorage.setItem("roleid", res.data.userinfo.roleid);
|
||||
|
||||
|
||||
navigate('/dashboard', { state: { firstname: res.data.userinfo.firstname } });
|
||||
setSubmitting(false)
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
setAlertmessage('Invalid Data');
|
||||
opentoast('Invalid Data');
|
||||
setLoading(false)
|
||||
setSubmitting(false)
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
setLoading(false)
|
||||
setSubmitting(false)
|
||||
}
|
||||
} else {
|
||||
// let el2 = document.getElementById('toastid');
|
||||
// el2.classList.add('d-block');
|
||||
// el2.classList.remove('d-none');
|
||||
setAlertmessage('Fill All required fields');
|
||||
opentoast('Fill All required fields');
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// const handleClose = () => {
|
||||
// setToast(false)
|
||||
// }
|
||||
const opentoast = (message) => {
|
||||
// setToast(true)
|
||||
|
||||
|
||||
|
||||
// setTimeout(() => {
|
||||
// // handleClose();
|
||||
// setToast(false)
|
||||
// }, 2000);
|
||||
enqueueSnackbar(message, {
|
||||
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||
autoHideDuration: 2000
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
return <>
|
||||
{/* <AuthWrapper> */}
|
||||
<Box sx={{ minHeight: '100vh' }}>
|
||||
{(loading) &&
|
||||
|
||||
<Loader />
|
||||
}
|
||||
{/* <AuthBackground /> */}
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
justifyContent="flex-start"
|
||||
sx={{
|
||||
minHeight: '100vh'
|
||||
}}
|
||||
>
|
||||
<Grid item xs={12}
|
||||
sx={{ ml: 3, mt: 3 }}
|
||||
|
||||
>
|
||||
|
||||
<img src={logo} alt='legendary'
|
||||
width='200px'
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Grid
|
||||
item
|
||||
xs={12}
|
||||
container
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }}
|
||||
>
|
||||
<Grid item>
|
||||
{/* <AuthCard>{children}</AuthCard> */}
|
||||
<Box sx={{
|
||||
maxWidth: { xs: 400, lg: 475 },
|
||||
margin: { xs: 2.5, md: 3 },
|
||||
'& > *': {
|
||||
flexGrow: 1,
|
||||
flexBasis: '50%'
|
||||
}
|
||||
}} >
|
||||
<Card sx={{
|
||||
position: 'relative',
|
||||
border: '1px solid',
|
||||
borderRadius: 1,
|
||||
borderColor: theme.palette.divider,
|
||||
boxShadow: 'inherit',
|
||||
p: 2,
|
||||
width: '100%'
|
||||
|
||||
|
||||
}}>
|
||||
{/* <CardHeader title={<Typography variant="h4">Login</Typography>} /> */}
|
||||
{/* <Divider sx={{ borderStyle: 'dashed' }} /> */}
|
||||
{/* <h1>eee</h1> */}
|
||||
{/* <CardHeader> */}
|
||||
|
||||
<Grid container
|
||||
spacing={3}
|
||||
>
|
||||
<Grid item xs={12}>
|
||||
<Stack direction="row" justifyContent="flex-start" alignItems="baseline"
|
||||
sx={{ mb: { xs: -0.5, sm: 0.5 } }}
|
||||
>
|
||||
<CardHeader
|
||||
title={<Typography variant="h3">Login</Typography>}
|
||||
/>
|
||||
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
{/* <Grid item xs={12}>
|
||||
<AuthLogin isDemo={isLoggedIn} />
|
||||
</Grid> */}
|
||||
</Grid>
|
||||
<CardContent>
|
||||
<form noValidate
|
||||
onSubmit={(e) => { e.preventDefault() }}
|
||||
>
|
||||
<Grid container
|
||||
spacing={2}
|
||||
>
|
||||
<Grid item xs={12}>
|
||||
{/* <Stack spacing={1}> */}
|
||||
{/* <InputLabel htmlFor="email-login">Email Address</InputLabel>
|
||||
<OutlinedInput
|
||||
id="email-login"
|
||||
type="email"
|
||||
value={values.email}
|
||||
name="email"
|
||||
onBlur={handleBlur}
|
||||
onChange={handleChange}
|
||||
placeholder="Enter email address"
|
||||
fullWidth
|
||||
id="username1"
|
||||
label="E-mail Address"
|
||||
variant="outlined"
|
||||
autoComplete='email'
|
||||
required
|
||||
onChange={usernamecheck}
|
||||
error={checkusername}
|
||||
error={Boolean(touched.email && errors.email)}
|
||||
/>
|
||||
{touched.email && errors.email && (
|
||||
<FormHelperText error id="standard-weight-helper-text-email-login">
|
||||
{errors.email}
|
||||
</FormHelperText>
|
||||
)} */}
|
||||
<TextField
|
||||
margin="normal"
|
||||
fullWidth
|
||||
id="username1" label="E-mail Address" variant="outlined" autoComplete='email' required
|
||||
onChange={usernamecheck}
|
||||
error={checkusername}
|
||||
/>
|
||||
<TextField
|
||||
margin="normal"
|
||||
fullWidth
|
||||
required
|
||||
autoComplete="current-password"
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
type='password' id="password1" label="Password" variant="outlined" />
|
||||
{/* </Stack> */}
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
{/* <Stack spacing={0}> */}
|
||||
{/* <InputLabel htmlFor="password-login">Password</InputLabel> */}
|
||||
{/* <OutlinedInput
|
||||
fullWidth
|
||||
// error={Boolean(touched.password && errors.password)}
|
||||
// id="-password-login"
|
||||
// type={showPassword ? 'text' : 'password'}
|
||||
// value={values.password}
|
||||
// name="password"
|
||||
// onBlur={handleBlur}
|
||||
// onChange={handleChange}
|
||||
// endAdornment={
|
||||
// <InputAdornment position="end">
|
||||
// <IconButton
|
||||
// aria-label="toggle password visibility"
|
||||
// onClick={handleClickShowPassword}
|
||||
// onMouseDown={handleMouseDownPassword}
|
||||
// edge="end"
|
||||
// color="secondary"
|
||||
// >
|
||||
// {showPassword ? <EyeOutlined /> : <EyeInvisibleOutlined />}
|
||||
// </IconButton>
|
||||
// </InputAdornment>
|
||||
// }
|
||||
placeholder="Enter password"
|
||||
// margin="normal"
|
||||
// fullWidth
|
||||
required
|
||||
autoComplete="current-password"
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
type='password' id="password1"
|
||||
/> */}
|
||||
{/* {touched.password && errors.password && (
|
||||
<FormHelperText error id="standard-weight-helper-text-password-login">
|
||||
{errors.password}
|
||||
</FormHelperText>
|
||||
)} */}
|
||||
|
||||
{/* </Stack> */}
|
||||
<Link href="#" variant="h6" >
|
||||
Forgot password?
|
||||
</Link>
|
||||
</Grid>
|
||||
|
||||
|
||||
{/* <Grid item xs={12} sx={{ mt: -1 }}>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
onChange={(event) => setChecked(event.target.checked)}
|
||||
name="checked"
|
||||
color="primary"
|
||||
size="small"
|
||||
/>
|
||||
}
|
||||
label={<Typography variant="h6">Keep me sign in</Typography>}
|
||||
/>
|
||||
<Link variant="h6" component={RouterLink} to={isDemo ? '/auth/forgot-password' : '/forgot-password'} color="text.primary">
|
||||
Forgot Password?
|
||||
</Link>
|
||||
</Stack>
|
||||
</Grid> */}
|
||||
{/* {errors.submit && (
|
||||
<Grid item xs={12}>
|
||||
<FormHelperText error>{errors.submit}</FormHelperText>
|
||||
</Grid>
|
||||
)} */}
|
||||
<Grid item xs={12}>
|
||||
{/* <AnimateButton> */}
|
||||
<AnimateButton>
|
||||
<Button
|
||||
disabled={submitting}
|
||||
|
||||
onClick={()=>{
|
||||
// loginsend()
|
||||
navigate('/dashboard')
|
||||
}}
|
||||
fullWidth size="large" type="submit" variant="contained" color="primary">
|
||||
Login
|
||||
</Button>
|
||||
</AnimateButton>
|
||||
{/* </AnimateButton> */}
|
||||
</Grid>
|
||||
</Grid>
|
||||
{/* </Grid> */}
|
||||
</form>
|
||||
</CardContent>
|
||||
{/* </CardHeader> */}
|
||||
|
||||
</Card>
|
||||
|
||||
</Box>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12}
|
||||
// sx={{ m: 3, mt: 1 }}
|
||||
>
|
||||
{/* <AuthFooter /> */}
|
||||
|
||||
|
||||
<Container maxWidth="xl">
|
||||
<Stack
|
||||
direction={{ sx: 'column', md: 'row' }}
|
||||
justifyContent={{ sx: 'center', md: 'space-between' }}
|
||||
spacing={2}
|
||||
// textAlign={{ sx: 'center', md: 'inherit' }}
|
||||
|
||||
alignItems={{ sx: 'center', md: 'inherit' }}
|
||||
width='100%'
|
||||
|
||||
>
|
||||
<Stack direction='row' justifyContent='center' spacing={1}>
|
||||
<Typography variant="subtitle2" color="secondary" component="span" sx={{ display: 'flex' }}>© All rights reserved
|
||||
{/* <Typography variant="subtitle2" href="#mantis-privacy" target="_blank" underline="hover" sx={{ml:1}}>Privacy Policy</Typography> */}
|
||||
|
||||
</Typography>
|
||||
</Stack>
|
||||
|
||||
<Stack direction={{ sx: 'column', md: 'row' }} spacing={{ sx: 1, md: 3 }}
|
||||
textAlign={{ sx: 'center', md: 'inherit' }}
|
||||
alignItems={{ sx: 'center', md: 'inherit' }}
|
||||
// width='100%'
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
color="secondary"
|
||||
component={Link}
|
||||
href="#"
|
||||
// target="_blank"
|
||||
underline="hover"
|
||||
textAlign='center'
|
||||
>
|
||||
Terms and Conditions
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
color="secondary"
|
||||
component={Link}
|
||||
href="#"
|
||||
// target="_blank"
|
||||
underline="hover"
|
||||
textAlign='center'
|
||||
>
|
||||
Privacy Policy
|
||||
</Typography>
|
||||
{/* <Typography
|
||||
variant="subtitle2"
|
||||
color="secondary"
|
||||
component={Link}
|
||||
href="#"
|
||||
// target="_blank"
|
||||
underline="hover"
|
||||
textAlign='center'
|
||||
>
|
||||
CA Privacy Notice
|
||||
</Typography> */}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Container>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Box >
|
||||
{/* </AuthWrapper> */}
|
||||
</>
|
||||
}
|
||||
|
||||
export default Login;
|
||||
@@ -1,17 +1,17 @@
|
||||
import { lazy } from 'react';
|
||||
// import { lazy } from 'react';
|
||||
|
||||
// project import
|
||||
import GuestGuard from 'utils/route-guard/GuestGuard';
|
||||
// import GuestGuard from 'utils/route-guard/GuestGuard';
|
||||
import CommonLayout from 'layout/CommonLayout';
|
||||
import Loadable from 'components/Loadable';
|
||||
// import Loadable from 'components/Loadable';
|
||||
|
||||
// render - login
|
||||
const AuthLogin = Loadable(lazy(() => import('pages/auth/login')));
|
||||
const AuthRegister = Loadable(lazy(() => import('pages/auth/register')));
|
||||
const AuthForgotPassword = Loadable(lazy(() => import('pages/auth/forgot-password')));
|
||||
const AuthCheckMail = Loadable(lazy(() => import('pages/auth/check-mail')));
|
||||
const AuthResetPassword = Loadable(lazy(() => import('pages/auth/reset-password')));
|
||||
const AuthCodeVerification = Loadable(lazy(() => import('pages/auth/code-verification')));
|
||||
// const AuthLogin = Loadable(lazy(() => import('pages/auth/login')));
|
||||
// const AuthRegister = Loadable(lazy(() => import('pages/auth/register')));
|
||||
// const AuthForgotPassword = Loadable(lazy(() => import('pages/auth/forgot-password')));
|
||||
// const AuthCheckMail = Loadable(lazy(() => import('pages/auth/check-mail')));
|
||||
// const AuthResetPassword = Loadable(lazy(() => import('pages/auth/reset-password')));
|
||||
// const AuthCodeVerification = Loadable(lazy(() => import('pages/auth/code-verification')));
|
||||
|
||||
// ==============================|| AUTH ROUTING ||============================== //
|
||||
|
||||
@@ -21,39 +21,39 @@ const LoginRoutes = {
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<GuestGuard>
|
||||
// <GuestGuard>
|
||||
<CommonLayout />
|
||||
</GuestGuard>
|
||||
// </GuestGuard>
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
element: <AuthLogin />
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
element: <AuthLogin />
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
element: <AuthRegister />
|
||||
},
|
||||
{
|
||||
path: 'forgot-password',
|
||||
element: <AuthForgotPassword />
|
||||
},
|
||||
{
|
||||
path: 'check-mail',
|
||||
element: <AuthCheckMail />
|
||||
},
|
||||
{
|
||||
path: 'reset-password',
|
||||
element: <AuthResetPassword />
|
||||
},
|
||||
{
|
||||
path: 'code-verification',
|
||||
element: <AuthCodeVerification />
|
||||
}
|
||||
// {
|
||||
// path: '/',
|
||||
// element: <AuthLogin />
|
||||
// },
|
||||
// {
|
||||
// path: 'login',
|
||||
// element: <AuthLogin />
|
||||
// },
|
||||
// {
|
||||
// path: 'register',
|
||||
// element: <AuthRegister />
|
||||
// },
|
||||
// {
|
||||
// path: 'forgot-password',
|
||||
// element: <AuthForgotPassword />
|
||||
// },
|
||||
// {
|
||||
// path: 'check-mail',
|
||||
// element: <AuthCheckMail />
|
||||
// },
|
||||
// {
|
||||
// path: 'reset-password',
|
||||
// element: <AuthResetPassword />
|
||||
// },
|
||||
// {
|
||||
// path: 'code-verification',
|
||||
// element: <AuthCodeVerification />
|
||||
// }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -4,7 +4,7 @@ import { lazy } from 'react';
|
||||
import MainLayout from 'layout/MainLayout';
|
||||
import CommonLayout from 'layout/CommonLayout';
|
||||
import Loadable from 'components/Loadable';
|
||||
import AuthGuard from 'utils/route-guard/AuthGuard';
|
||||
// import AuthGuard from 'utils/route-guard/AuthGuard';
|
||||
|
||||
// pages routing
|
||||
const MaintenanceError = Loadable(lazy(() => import('pages/maintenance/404')));
|
||||
@@ -14,6 +14,10 @@ const MaintenanceComingSoon = Loadable(lazy(() => import('pages/maintenance/comi
|
||||
|
||||
// render - sample page
|
||||
const SamplePage = Loadable(lazy(() => import('pages/extra-pages/sample-page')));
|
||||
const Login = Loadable(lazy(() => import('pages/nearle/login')));
|
||||
const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));
|
||||
|
||||
|
||||
|
||||
// ==============================|| MAIN ROUTING ||============================== //
|
||||
|
||||
@@ -23,17 +27,26 @@ const MainRoutes = {
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<AuthGuard>
|
||||
// <AuthGuard>
|
||||
<MainLayout />
|
||||
</AuthGuard>
|
||||
// </AuthGuard>
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: 'sample-page',
|
||||
element: <SamplePage />
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
element: <Dashboard />
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'/login',
|
||||
element:<Login />
|
||||
},
|
||||
{
|
||||
path: '/maintenance',
|
||||
element: <CommonLayout />,
|
||||
|
||||
@@ -3,8 +3,11 @@ import { REGISTER, LOGIN, LOGOUT } from './actions';
|
||||
|
||||
// initial state
|
||||
export const initialState = {
|
||||
isLoggedIn: false,
|
||||
isInitialized: false,
|
||||
// isLoggedIn: false,
|
||||
// isInitialized: false,
|
||||
// user: null
|
||||
isLoggedIn: true,
|
||||
isInitialized: true,
|
||||
user: null
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user