| @@ -0,0 +1,33 @@ | |||
| import { useState, useEffect, createContext } from 'react'; | |||
| import { get } from "utils/HttpUtils" | |||
| import {GET_SYS_SETTING} from "utils/ApiPathConst" | |||
| const SysContext = createContext(); | |||
| const SysSettingProvider = ({ children }) => { | |||
| const [sysSetting, setSysSetting] = useState({}); | |||
| useEffect(() => { | |||
| loadSysSetting(); | |||
| }, []); | |||
| const loadSysSetting = () => { | |||
| get({ | |||
| url: GET_SYS_SETTING, | |||
| onSuccess: (responseData) => { | |||
| setSysSetting(responseData); | |||
| } | |||
| }); | |||
| } | |||
| return ( | |||
| <SysContext.Provider value={{ sysSetting, setSysSetting }} > | |||
| {children} | |||
| </SysContext.Provider> | |||
| ); | |||
| } | |||
| export {SysContext, SysSettingProvider}; | |||
| @@ -16,9 +16,10 @@ import 'assets/third-party/apex-chart.css'; | |||
| import App from './App'; | |||
| import { store } from 'store'; | |||
| import reportWebVitals from './reportWebVitals'; | |||
| import {I18nProvider} from "components/I18nProvider"; | |||
| import {AutoLogoutProvider} from "components/AutoLogoutProvider"; | |||
| import {RefreshTokenProvider} from "components/RefreshTokenProvider"; | |||
| import { I18nProvider } from "components/I18nProvider"; | |||
| import { AutoLogoutProvider } from "components/AutoLogoutProvider"; | |||
| import { RefreshTokenProvider } from "components/RefreshTokenProvider"; | |||
| import { SysSettingProvider } from "components/SysSettingProvider"; | |||
| // ==============================|| MAIN - REACT DOM RENDER ||============================== // | |||
| @@ -26,18 +27,21 @@ const container = document.getElementById('root'); | |||
| const root = createRoot(container); // createRoot(container!) if you use TypeScript | |||
| //const NotAuthorized = lazy(() => import('../views/NotAuthorized')) | |||
| //const Error = lazy(() => import('../views/Error')) | |||
| root.render( | |||
| <StrictMode> | |||
| <ReduxProvider store={store}> | |||
| <SysSettingProvider> | |||
| <I18nProvider> | |||
| <BrowserRouter basename="/"> | |||
| <RefreshTokenProvider> | |||
| <AutoLogoutProvider> | |||
| <App /> | |||
| <App /> | |||
| </AutoLogoutProvider> | |||
| </RefreshTokenProvider> | |||
| </BrowserRouter> | |||
| </I18nProvider> | |||
| </SysSettingProvider> | |||
| </ReduxProvider> | |||
| </StrictMode> | |||
| ); | |||
| @@ -1,9 +1,10 @@ | |||
| import PropTypes from 'prop-types'; | |||
| import React | |||
| , { useState } | |||
| , { useState, useContext } | |||
| from 'react'; | |||
| import { useDispatch } from "react-redux"; | |||
| import { useNavigate } from "react-router-dom"; | |||
| import { SysContext } from "components/SysSettingProvider" | |||
| // material-ui | |||
| // import { useTheme } from '@mui/material/styles'; | |||
| @@ -68,6 +69,7 @@ const drawerWidth = 300; | |||
| // ==============================|| MAIN LAYOUT - HEADER ||============================== // | |||
| function Header(props) { | |||
| const { sysSetting } = useContext(SysContext); | |||
| const { window } = props; | |||
| const [mobileOpen, setMobileOpen] = useState(false); | |||
| const dispatch = useDispatch() | |||
| @@ -87,7 +89,7 @@ function Header(props) { | |||
| const loginContent = ( | |||
| isGLDLoggedIn() ? | |||
| <div id="adminContent"> | |||
| {isPasswordExpiry()? | |||
| {isPasswordExpiry() ? | |||
| <div id="passwordExpiryedContent"> | |||
| <li> | |||
| <Link className="manageUser" to={'/user/changePassword'}> | |||
| @@ -99,7 +101,7 @@ function Header(props) { | |||
| </div> | |||
| : | |||
| <div id="adminContentList"> | |||
| <li> | |||
| <li> | |||
| <Link className="dashboard" to='/dashboard'> | |||
| <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} > | |||
| Dashboard | |||
| @@ -148,7 +150,7 @@ function Header(props) { | |||
| : | |||
| <></> | |||
| } | |||
| { | |||
| isGranted("MAINTAIN_RECON") ? | |||
| <> | |||
| @@ -316,7 +318,7 @@ function Header(props) { | |||
| </div> | |||
| : | |||
| <div id="individualUserContent"> | |||
| {isPasswordExpiry()? | |||
| {isPasswordExpiry() ? | |||
| <div id="passwordExpiryedContent"> | |||
| <li> | |||
| <Link className="manageUser" to={'/user/changePassword'}> | |||
| @@ -345,7 +347,7 @@ function Header(props) { | |||
| </li> | |||
| <li> | |||
| {isCreditorLoggedIn() ? | |||
| haveOrgPaymentRecord()? | |||
| haveOrgPaymentRecord() ? | |||
| <> | |||
| <Link className="paymentRecord"> | |||
| <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}> | |||
| @@ -366,21 +368,21 @@ function Header(props) { | |||
| </li> | |||
| </ul> | |||
| </> | |||
| : | |||
| : | |||
| <Link className="manageOrgUser" to='/paymentPage/demandNote'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}> | |||
| <FormattedMessage id="paymentInfoRecord" /> | |||
| </Typography></Link> | |||
| : | |||
| isORGLoggedIn()? | |||
| haveOrgPaymentRecord()? | |||
| : | |||
| isORGLoggedIn() ? | |||
| haveOrgPaymentRecord() ? | |||
| <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}> | |||
| <FormattedMessage id="onlinePaymentHistory" /> | |||
| </Typography></Link> | |||
| : | |||
| : | |||
| <Link className="manageOrgUser" to='/paymentPage/demandNote'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}> | |||
| <FormattedMessage id="paymentInfoRecord" /> | |||
| </Typography></Link> | |||
| : | |||
| : | |||
| <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}> | |||
| <FormattedMessage id="onlinePaymentHistory" /> | |||
| </Typography></Link> | |||
| @@ -497,7 +499,7 @@ function Header(props) { | |||
| const logoutContent = ( | |||
| <div> | |||
| <li> | |||
| <li> | |||
| <Link className="login" to={'/aboutUs'}> | |||
| <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> | |||
| <FormattedMessage id="aboutUs" /> | |||
| @@ -511,13 +513,18 @@ function Header(props) { | |||
| </Typography> | |||
| </Link> | |||
| </li> | |||
| <li> | |||
| <Link className="register" to='/register'> | |||
| <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> | |||
| <FormattedMessage id="register" /> | |||
| </Typography> | |||
| </Link> | |||
| </li> | |||
| { | |||
| sysSetting?.allowRegistration ? | |||
| <li> | |||
| <Link className="register" to='/register'> | |||
| <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> | |||
| <FormattedMessage id="register" /> | |||
| </Typography> | |||
| </Link> | |||
| </li> | |||
| : | |||
| <></> | |||
| } | |||
| </div> | |||
| ); | |||
| @@ -1,48 +1,20 @@ | |||
| // import { useFormik } from 'formik'; | |||
| // import * as yup from 'yup'; | |||
| import * as React from "react"; | |||
| // import * as HttpUtils from "utils/HttpUtils"; | |||
| // import * as UrlUtils from "utils/ApiPathConst"; | |||
| // import { useNavigate } from "react-router-dom"; | |||
| // import { useDispatch } from "react-redux"; | |||
| // import { handleLogoutFunction, handleLogin} from 'auth/index'; | |||
| // import useJwt from "auth/jwt/useJwt"; | |||
| import { | |||
| Grid, | |||
| Typography, | |||
| Button, | |||
| // RadioGroup, | |||
| // Dialog, DialogTitle, DialogContent, DialogActions, | |||
| Stack, | |||
| // InputLabel, | |||
| // OutlinedInput, | |||
| // FormHelperText, | |||
| // TextField, | |||
| // IconButton, InputAdornment, | |||
| // Box, | |||
| // FormControl | |||
| } from '@mui/material'; | |||
| import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
| // import ForwardIcon from '@mui/icons-material/Forward'; | |||
| import MainCard from 'components/MainCard'; | |||
| // import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; | |||
| // import {ThemeProvider} from "@emotion/react"; | |||
| import {FormattedMessage, | |||
| // useIntl | |||
| } from "react-intl"; | |||
| // import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| // import axios from 'axios'; | |||
| import { | |||
| // useParams, | |||
| Link | |||
| } from 'react-router-dom'; | |||
| import {FormattedMessage,} from "react-intl"; | |||
| import { Link } from 'react-router-dom'; | |||
| import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; | |||
| // import LocaleContext from "components/I18nProvider"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const ResetPasswordSuccess = () => { | |||
| @@ -6,7 +6,7 @@ import * as UrlUtils from "utils/ApiPathConst"; | |||
| import { useNavigate } from "react-router-dom"; | |||
| import { useDispatch } from "react-redux"; | |||
| import { handleLogoutFunction, | |||
| // handleLogin | |||
| } from 'auth/index'; | |||
| import useJwt from "auth/jwt/useJwt"; | |||
| @@ -14,21 +14,17 @@ import { | |||
| Grid, | |||
| Typography, | |||
| Button, | |||
| // RadioGroup, | |||
| // Dialog, DialogTitle, DialogContent, DialogActions, | |||
| Stack, | |||
| InputLabel, | |||
| // OutlinedInput, | |||
| FormHelperText, | |||
| TextField, | |||
| IconButton, InputAdornment, | |||
| // Box, | |||
| // FormControl | |||
| } from '@mui/material'; | |||
| import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
| // import ForwardIcon from '@mui/icons-material/Forward'; | |||
| import MainCard from 'components/MainCard'; | |||
| import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; | |||
| import {ThemeProvider} from "@emotion/react"; | |||
| @@ -37,7 +33,7 @@ import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| import axios from 'axios'; | |||
| import { useParams,Link } from 'react-router-dom'; | |||
| import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | |||
| // import LocaleContext from "components/I18nProvider"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| @@ -50,7 +46,7 @@ const Index = () => { | |||
| const [verifyState, setVerifyState] = React.useState(null) | |||
| const [enterUseEffect, setEnterUseEffect] = React.useState(false) | |||
| const [username, setUsername] = React.useState("") | |||
| // const { setLocale } = React.useContext(LocaleContext); | |||
| const params = useParams() | |||
| const intl = useIntl(); | |||
| @@ -61,7 +57,6 @@ const Index = () => { | |||
| }, []); | |||
| React.useEffect(() => { | |||
| // console.log("if (enterUseEffect) handleVerify()"); | |||
| if (enterUseEffect){ | |||
| handleVerify() | |||
| } | |||
| @@ -161,14 +156,10 @@ const Index = () => { | |||
| const formik = useFormik({ | |||
| enableReinitialize: true, | |||
| initialValues: { | |||
| // username: '', | |||
| password: '', | |||
| confirmPassword: '', | |||
| // emailVerifyHash: '', | |||
| }, | |||
| validationSchema: yup.object().shape({ | |||
| // emailVerifyHash: yup.string().required(intl.formatMessage({id: 'requireSecurityCode'})), | |||
| // username: yup.string().required(intl.formatMessage({id: 'requireUsername'})), | |||
| password: yup.string().min(8, intl.formatMessage({id: 'atLeast8CharPassword'})) | |||
| .required(intl.formatMessage({id: 'requirePassword'})) | |||
| .matches(/^\S*$/, { message: (intl.formatMessage({id: 'noSpacePassword'}))}) | |||
| @@ -204,18 +195,7 @@ const Index = () => { | |||
| </Stack> | |||
| </div> | |||
| </Grid> | |||
| {/* <Grid item xs={12} width={{xs:"90%", sm:"90%", md:"60%", lg:"60%"}}> | |||
| <Button | |||
| aria-label={intl.formatMessage({id: 'back'})} | |||
| title={intl.formatMessage({id: 'back'})} | |||
| sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }} | |||
| > | |||
| <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} /> | |||
| </Button> | |||
| </Grid> */} | |||
| {/* <Grid item xs={12}> | |||
| <Typography variant="pnspsFormParagraphBold">申請公共啟事</Typography> | |||
| </Grid> */} | |||
| <Grid item xs={12} md={12} width={{ sx:"90%", sm:"90%",md: "60%", xs: "90%" }}> | |||
| <MainCard | |||
| sx={{ | |||
| @@ -248,40 +228,7 @@ const Index = () => { | |||
| </InputLabel> | |||
| </Grid> | |||
| </Grid> | |||
| {/* <Grid item xs={12} md={12} lg={12} width={{xs:"70%", sm:"60%",md:"50%", lg:"50%"}}> | |||
| <Grid container direction="row" justifyContent="flex-start"> | |||
| <Grid item xs={12} md={12} lg={12}> | |||
| <TextField | |||
| fullWidth | |||
| onChange={formik.handleChange} | |||
| id="emailVerifyHash" | |||
| name="emailVerifyHash" | |||
| label={intl.formatMessage({id: 'securityCode'}) + ":"} | |||
| placeholder={intl.formatMessage({id: 'securityCode'})} | |||
| defaultValue={formik.values.emailVerifyHash} | |||
| value={formik.values.emailVerifyHash} | |||
| error={Boolean(formik.touched.emailVerifyHash && formik.errors.emailVerifyHash)} | |||
| onBlur={formik.handleBlur} | |||
| inputProps={{ | |||
| maxLength: 50, | |||
| onKeyDown: (e) => { | |||
| if (e.key === 'Enter') { | |||
| e.preventDefault(); | |||
| } | |||
| }, | |||
| }} | |||
| InputLabelProps={{ | |||
| shrink: true | |||
| }} | |||
| /> | |||
| </Grid> | |||
| {formik.touched.emailVerifyHash && formik.errors.emailVerifyHash && ( | |||
| <FormHelperText error id="standard-weight-helper-text-username-login"> | |||
| {formik.errors.emailVerifyHash} | |||
| </FormHelperText> | |||
| )} | |||
| </Grid> | |||
| </Grid> */} | |||
| <Grid item xs={12} md={12} lg={12} width={{xs:"70%", sm:"60%",md:"50%", lg:"50%"}}> | |||
| <Grid container direction="row" justifyContent="flex-start"> | |||
| <Grid item xs={12} md={12} lg={12}> | |||
| @@ -291,7 +238,7 @@ const Index = () => { | |||
| name="username" | |||
| label={intl.formatMessage({id: 'userLoginName'}) + ":"} | |||
| placeholder={intl.formatMessage({id: 'userLoginName'})} | |||
| // defaultValue={username} | |||
| value={username} | |||
| disabled={true} /> | |||
| </Grid> | |||
| @@ -312,7 +259,7 @@ const Index = () => { | |||
| name="password" | |||
| label={intl.formatMessage({id: 'newPassword'}) + ":"} | |||
| placeholder={intl.formatMessage({id: 'newPassword'})} | |||
| // defaultValue={formik.values.password.trim()} | |||
| value={formik.values.password.trim()} | |||
| error={Boolean(formik.touched.password && formik.errors.password)} | |||
| onBlur={formik.handleBlur} | |||
| @@ -343,18 +290,7 @@ const Index = () => { | |||
| }} | |||
| /> | |||
| </Grid> | |||
| {/* <FormControl fullWidth sx={{ mt: 2 }}> | |||
| <Grid container spacing={2} alignItems="center"> | |||
| <Grid item> | |||
| <Box sx={{ bgcolor: level?.color, width: 85, height: 8, borderRadius: '7px' }} /> | |||
| </Grid> | |||
| <Grid item> | |||
| <Typography variant="subtitle1"> | |||
| <FormattedMessage id={level ? level?.label : "pwWeak" }/> | |||
| </Typography> | |||
| </Grid> | |||
| </Grid> | |||
| </FormControl> */} | |||
| {formik.touched.password && formik.errors.password && ( | |||
| <FormHelperText error id="helper-text-password-signup"> | |||
| {formik.errors.password} | |||
| @@ -369,14 +305,14 @@ const Index = () => { | |||
| fullWidth | |||
| onChange={(e) => { | |||
| formik.handleChange(e); | |||
| // changePassword(e.target.value); | |||
| }} | |||
| id="confirmPassword" | |||
| type={showConfirmPassword ? 'text' : 'password'} | |||
| name="confirmPassword" | |||
| label={intl.formatMessage({id: 'confirmPassword'}) + ":"} | |||
| placeholder={intl.formatMessage({id: 'confirmPassword'})} | |||
| // defaultValue={formik.values.confirmPassword.trim()} | |||
| value={formik.values.confirmPassword.trim()} | |||
| error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)} | |||
| onBlur={formik.handleBlur} | |||
| @@ -432,7 +368,6 @@ const Index = () => { | |||
| // ERROR page | |||
| <Grid container spacing={4} sx={{ minHeight: {xs:"80vh", sm:"70vh", md: "70vh", lg:"70vh", xl:"50vh"} }} direction="column" justifyContent="flex-start" alignItems="center"> | |||
| <Grid item xs={12} md={12} lg={12} sx={{ mb: 1, mt:5,}}> | |||
| {/* <Button disabled={true} hidden={true} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> */} | |||
| <CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} /> | |||
| </Grid> | |||
| <Grid item xs={12} md={12} lg={12} sx={{ mb: 1, mt:5,}}> | |||
| @@ -1,70 +1,32 @@ | |||
| // import { useFormik } from 'formik'; | |||
| // import * as yup from 'yup'; | |||
| import * as React from "react"; | |||
| // import * as HttpUtils from "utils/HttpUtils"; | |||
| // import * as UrlUtils from "utils/ApiPathConst"; | |||
| // import { useNavigate } from "react-router-dom"; | |||
| // import { useDispatch } from "react-redux"; | |||
| // import { handleLogoutFunction, handleLogin} from 'auth/index'; | |||
| // import useJwt from "auth/jwt/useJwt"; | |||
| import { | |||
| Grid, | |||
| Typography, | |||
| Button, | |||
| // RadioGroup, | |||
| // Dialog, DialogTitle, DialogContent, DialogActions, | |||
| Stack, | |||
| // InputLabel, | |||
| // OutlinedInput, | |||
| // FormHelperText, | |||
| // TextField, | |||
| // IconButton, InputAdornment, | |||
| // Box, | |||
| // FormControl | |||
| } from '@mui/material'; | |||
| import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
| // import ForwardIcon from '@mui/icons-material/Forward'; | |||
| import MainCard from 'components/MainCard'; | |||
| // import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; | |||
| // import {ThemeProvider} from "@emotion/react"; | |||
| import {FormattedMessage, | |||
| // useIntl | |||
| } from "react-intl"; | |||
| // import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| // import axios from 'axios'; | |||
| import { | |||
| // useParams, | |||
| Link | |||
| } from 'react-router-dom'; | |||
| import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; | |||
| // import LocaleContext from "components/I18nProvider"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| const ResetPasswordSuccess = () => { | |||
| // const dispatch = useDispatch() | |||
| // const navigate = useNavigate() | |||
| const [isLoading, setLoding] = React.useState(true); | |||
| // const params = useParams() | |||
| // const intl = useIntl(); | |||
| React.useEffect(() => { | |||
| // console.log(params); | |||
| setLoding(false) | |||
| }, []); | |||
| // React.useEffect(() => { | |||
| // // console.log("if (enterUseEffect) handleVerify()"); | |||
| // if (enterUseEffect){ | |||
| // handleVerify() | |||
| // } | |||
| // }, [enterUseEffect]) | |||
| const BackgroundHead = { | |||
| backgroundImage: `url(${titleBackgroundImg})`, | |||
| width: 'auto', | |||
| @@ -37,7 +37,6 @@ import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| import axios from 'axios'; | |||
| import { useParams,Link } from 'react-router-dom'; | |||
| import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | |||
| // import LocaleContext from "components/I18nProvider"; | |||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
| @@ -1,17 +1,12 @@ | |||
| import React, { | |||
| // useContext, | |||
| useEffect, useState} from 'react'; | |||
| import {useNavigate} from 'react-router-dom'; | |||
| // material-ui | |||
| import { | |||
| Button, | |||
| //Checkbox, | |||
| //Divider, | |||
| //FormControlLabel, | |||
| FormHelperText, | |||
| Grid, | |||
| //Link, | |||
| IconButton, | |||
| InputAdornment, | |||
| InputLabel, | |||
| @@ -25,9 +20,7 @@ import * as Yup from 'yup'; | |||
| import { Formik } from 'formik'; | |||
| // project import | |||
| //import FirebaseSocial from './FirebaseSocial'; | |||
| import AnimateButton from 'components/@extended/AnimateButton'; | |||
| //import {AbilityContext} from "@src/utility/context/Can" | |||
| import {apiPath} from "auth/utils"; | |||
| import {POST_LOGIN} from "utils/ApiPathConst"; | |||
| @@ -36,9 +29,7 @@ import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'; | |||
| import axios from "axios"; | |||
| import {useDispatch} from "react-redux"; | |||
| import {handleLogin} from "auth/index"; | |||
| // import { notifyActionSuccess } from 'utils/CommonFunction'; | |||
| import {FormattedMessage} from "react-intl"; | |||
| // import LocaleContext from "../../../components/I18nProvider"; | |||
| // ============================|| FIREBASE - LOGIN ||============================ // | |||
| const AuthLogin = () => { | |||
| @@ -224,14 +215,6 @@ const AuthLogin = () => { | |||
| </Button> | |||
| </AnimateButton> | |||
| </Grid> | |||
| {/*<Grid item xs={12}>*/} | |||
| {/* <Divider>*/} | |||
| {/* <Typography variant="caption"> Login with</Typography>*/} | |||
| {/* </Divider>*/} | |||
| {/*</Grid>*/} | |||
| {/*<Grid item xs={12}>*/} | |||
| {/* <FirebaseSocial />*/} | |||
| {/*</Grid>*/} | |||
| </Grid> | |||
| </form> | |||
| )} | |||
| @@ -2,7 +2,7 @@ import { | |||
| useEffect, | |||
| useState, | |||
| lazy, | |||
| // useContext | |||
| useContext | |||
| } from 'react'; | |||
| import { Link as RouterLink } from 'react-router-dom'; | |||
| import { useNavigate } from 'react-router-dom'; | |||
| @@ -12,14 +12,10 @@ import { getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||
| import * as HttpUtils from "utils/HttpUtils"; | |||
| import { I_AM_SMART_PATH } from "utils/ApiPathConst"; | |||
| //iAmSmartAppPath | |||
| // material-ui | |||
| import { | |||
| Button, | |||
| //Checkbox, | |||
| //Divider, | |||
| //FormControlLabel, | |||
| FormHelperText, | |||
| Grid, | |||
| Link, | |||
| @@ -35,8 +31,6 @@ import { | |||
| import * as yup from 'yup'; | |||
| import { useFormik, FormikProvider } from 'formik'; | |||
| // project import | |||
| //import FirebaseSocial from './FirebaseSocial'; | |||
| import AnimateButton from 'components/@extended/AnimateButton'; | |||
| import Loadable from 'components/Loadable'; | |||
| const PasswordAlertDialog = Loadable(lazy(() => import('./PasswordAlertDialog'))); | |||
| @@ -49,9 +43,9 @@ import { handleLogin } from "auth/index"; | |||
| import useJwt from "auth/jwt/useJwt"; | |||
| import { handleLogoutFunction } from 'auth/index'; | |||
| import { FormattedMessage, useIntl } from "react-intl"; | |||
| import { SysContext } from "components/SysSettingProvider" | |||
| import {IAmSmartButton} from "components/iAmSmartButton"; | |||
| // import LocaleContext from "components/I18nProvider"; | |||
| import { IAmSmartButton } from "components/iAmSmartButton"; | |||
| const LoadingComponent = Loadable(lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| // ============================|| FIREBASE - LOGIN ||============================ // | |||
| @@ -61,14 +55,13 @@ const AuthLoginCustom = () => { | |||
| const navigate = useNavigate() | |||
| const intl = useIntl(); | |||
| const { locale } = intl; | |||
| // const { setLocaleFromLogin } = useContext(LocaleContext); | |||
| const { sysSetting } = useContext(SysContext); | |||
| const [showPassword, setShowPassword] = useState(false); | |||
| const handleClickShowPassword = () => { | |||
| setShowPassword(!showPassword); | |||
| }; | |||
| // let [posts, setPosts] = useState([]); | |||
| const [isValid, setisValid] = useState(false); | |||
| const [open, setOpen] = useState(false); | |||
| const [isButtonDisabled, setIsButtonDisabled] = useState(true); | |||
| @@ -149,7 +142,6 @@ const AuthLoginCustom = () => { | |||
| submit: null | |||
| }), | |||
| validationSchema: yup.object().shape({ | |||
| // username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱'), | |||
| username: yup.string().required(intl.formatMessage({ id: 'requireUsername' })), | |||
| password: yup.string().min(8, intl.formatMessage({ id: 'atLeast8CharPassword' })).required(intl.formatMessage({ id: 'requirePassword' })) | |||
| .matches(/^(?=.*[a-z])/, intl.formatMessage({ id: 'atLeastOneSmallLetter' })) | |||
| @@ -208,7 +200,7 @@ const AuthLoginCustom = () => { | |||
| const { handleSubmit } = useForm({}) | |||
| function getQRWithIAmSmart(){ | |||
| function getQRWithIAmSmart() { | |||
| if (isAppBowser()) { | |||
| openApp(); | |||
| } else { | |||
| @@ -231,10 +223,10 @@ const AuthLoginCustom = () => { | |||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||
| //+"&state=" | |||
| + "&brokerPage=false" | |||
| window.location = url; | |||
| window.location = url; | |||
| } | |||
| }); | |||
| } | |||
| const openApp = () => { | |||
| @@ -269,7 +261,7 @@ const AuthLoginCustom = () => { | |||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||
| //+"&state=" | |||
| + "&brokerPage=false" | |||
| window.location = url; | |||
| window.location = url; | |||
| } | |||
| }); | |||
| @@ -393,35 +385,44 @@ const AuthLoginCustom = () => { | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| <Grid item xs={12}> | |||
| <Grid container> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <IAmSmartButton | |||
| label={intl.formatMessage({ id: "iAmSmartLogin" })} | |||
| onClickFun={getQRWithIAmSmart} | |||
| fullWidth={true} | |||
| /> | |||
| </Stack> | |||
| </Grid> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <Link href={intl.formatMessage({ id: "iamsmartLink" })} color="primary" sx={{ textDecoration: "none" }}> | |||
| <Typography align="center" variant="h7"> | |||
| {intl.formatMessage({ id: 'learnMore' }) + " >"} | |||
| </Typography> | |||
| </Link> | |||
| </Stack> | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <Button fullWidth size="large" variant="outlined" href="/register" ><Typography variant="h5"> | |||
| <FormattedMessage id="createOrReActivate" /> | |||
| </Typography></Button> | |||
| </Stack> | |||
| </Grid> | |||
| { | |||
| sysSetting?.allowRegistration ? | |||
| <> | |||
| <Grid item xs={12} > | |||
| <Grid container> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <IAmSmartButton | |||
| label={intl.formatMessage({ id: "iAmSmartLogin" })} | |||
| onClickFun={getQRWithIAmSmart} | |||
| fullWidth={true} | |||
| /> | |||
| </Stack> | |||
| </Grid> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <Link href={intl.formatMessage({ id: "iamsmartLink" })} color="primary" sx={{ textDecoration: "none" }}> | |||
| <Typography align="center" variant="h7"> | |||
| {intl.formatMessage({ id: 'learnMore' }) + " >"} | |||
| </Typography> | |||
| </Link> | |||
| </Stack> | |||
| </Grid> | |||
| </Grid> | |||
| </Grid> | |||
| <Grid item xs={12}> | |||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||
| <Button fullWidth size="large" variant="outlined" href="/register" ><Typography variant="h5"> | |||
| <FormattedMessage id="createOrReActivate" /> | |||
| </Typography></Button> | |||
| </Stack> | |||
| </Grid> | |||
| </> | |||
| : | |||
| <></> | |||
| } | |||
| </Grid> | |||
| <PasswordAlertDialog open={open} handleClose={handleClose} errorMassage={errorMassage} /> | |||
| </form> | |||
| @@ -1,4 +1,5 @@ | |||
| import { lazy } from 'react'; | |||
| import { lazy, useContext } from 'react'; | |||
| import { SysContext } from "components/SysSettingProvider" | |||
| // project import | |||
| import Loadable from 'components/Loadable'; | |||
| @@ -39,111 +40,121 @@ const Payment_FPS_CallBack = Loadable(lazy(() => import('pages/Payment/FPS/fpsca | |||
| // ==============================|| AUTH ROUTING ||============================== // | |||
| const LoginRoutes = { | |||
| path: '/', | |||
| element: <MainLayout />, | |||
| children: [ | |||
| { | |||
| path: 'login', | |||
| element: <AuthLogin /> | |||
| }, | |||
| { | |||
| path: 'register', | |||
| element: <AuthRegister /> | |||
| }, | |||
| { | |||
| path: 'registerFrom', | |||
| element: <RegisterForm /> | |||
| }, | |||
| { | |||
| path: 'registerFromOrganization', | |||
| element: <BusRegisterForm /> | |||
| }, | |||
| { | |||
| path: 'iAmSmartRegisterFrom', | |||
| element: <IAmSmartRegister /> | |||
| }, | |||
| { | |||
| path: 'error', | |||
| element: <ErrorPage/> | |||
| }, | |||
| { | |||
| path: 'privacyPolicy', | |||
| element: <PrivacyPolicyPage/> | |||
| }, | |||
| { | |||
| path: 'aboutUs', | |||
| element: <AboutUsPage/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/logincallback', | |||
| element: <IAmSmart_DirectLoginCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/loginfallback', | |||
| element: <IAmSmart_FailCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/notverify', | |||
| element: <FailCallback_VerifyMail/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/authcallback', | |||
| element: <IAmSmart_AuthCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/registrycallback', | |||
| element: <IAmSmart_RegistryCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/loginFail', | |||
| element: <IAmSmart_FailCallback/> | |||
| }, | |||
| { | |||
| path: 'verify/:verifyCode/:email', | |||
| element: <VerifyPage/> | |||
| }, | |||
| { | |||
| path: 'testfps', | |||
| element: <Testfps/> | |||
| }, | |||
| { | |||
| path: 'testfpscallback', | |||
| element: <Payment_FPS_CallBack/> | |||
| }, | |||
| { | |||
| path: 'forgot/password', | |||
| element: <ForgotPassword/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/sent', | |||
| element: <AfterForgotPasswordPage/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/verify/:verifyCode/:email', | |||
| element: <ForgotPassword_Callback/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/success', | |||
| element: <ForgotPassword_Success/> | |||
| }, | |||
| { | |||
| path: 'forgot/username', | |||
| element: <ForgotUsername/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/sent', | |||
| element: <AfterForgotUsernamePage/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/verify/:verifyCode/:email', | |||
| element: <ForgotUsername_Callback/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/success', | |||
| element: <ForgotUsername_Success/> | |||
| }, | |||
| ] | |||
| }; | |||
| export default function LoginRoutes(){ | |||
| const { sysSetting } = useContext(SysContext); | |||
| return { | |||
| path: '/', | |||
| element: <MainLayout />, | |||
| children: [ | |||
| { | |||
| path: 'login', | |||
| element: <AuthLogin /> | |||
| }, | |||
| ... sysSetting?.allowRegistration ?[ | |||
| { | |||
| path: 'register', | |||
| element: <AuthRegister /> | |||
| }, | |||
| { | |||
| path: 'registerFrom', | |||
| element: <RegisterForm /> | |||
| }, | |||
| { | |||
| path: 'registerFromOrganization', | |||
| element: <BusRegisterForm /> | |||
| }, | |||
| { | |||
| path: 'iAmSmartRegisterFrom', | |||
| element: <IAmSmartRegister /> | |||
| }, | |||
| { | |||
| path: 'iamsmart/registrycallback', | |||
| element: <IAmSmart_RegistryCallback/> | |||
| }, | |||
| { | |||
| path: 'verify/:verifyCode/:email', | |||
| element: <VerifyPage/> | |||
| }, | |||
| ]:[] | |||
| , | |||
| { | |||
| path: 'error', | |||
| element: <ErrorPage/> | |||
| }, | |||
| { | |||
| path: 'privacyPolicy', | |||
| element: <PrivacyPolicyPage/> | |||
| }, | |||
| { | |||
| path: 'aboutUs', | |||
| element: <AboutUsPage/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/logincallback', | |||
| element: <IAmSmart_DirectLoginCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/loginfallback', | |||
| element: <IAmSmart_FailCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/notverify', | |||
| element: <FailCallback_VerifyMail/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/authcallback', | |||
| element: <IAmSmart_AuthCallback/> | |||
| }, | |||
| { | |||
| path: 'iamsmart/loginFail', | |||
| element: <IAmSmart_FailCallback/> | |||
| }, | |||
| { | |||
| path: 'testfps', | |||
| element: <Testfps/> | |||
| }, | |||
| { | |||
| path: 'testfpscallback', | |||
| element: <Payment_FPS_CallBack/> | |||
| }, | |||
| { | |||
| path: 'forgot/password', | |||
| element: <ForgotPassword/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/sent', | |||
| element: <AfterForgotPasswordPage/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/verify/:verifyCode/:email', | |||
| element: <ForgotPassword_Callback/> | |||
| }, | |||
| { | |||
| path: 'forgot/password/success', | |||
| element: <ForgotPassword_Success/> | |||
| }, | |||
| { | |||
| path: 'forgot/username', | |||
| element: <ForgotUsername/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/sent', | |||
| element: <AfterForgotUsernamePage/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/verify/:verifyCode/:email', | |||
| element: <ForgotUsername_Callback/> | |||
| }, | |||
| { | |||
| path: 'forgot/username/success', | |||
| element: <ForgotUsername_Success/> | |||
| }, | |||
| ] | |||
| }; | |||
| } | |||
| // export default LoginRoutes; | |||
| export default LoginRoutes; | |||
| @@ -51,9 +51,9 @@ export default function ThemeRoutes() { | |||
| path: '/dashboard', | |||
| element: <Navigate to="/login" /> | |||
| }, | |||
| isUserLoggedIn() && isINDLoggedIn() || isUserLoggedIn() && isORGLoggedIn() ? PublicUserRoutes : LoginRoutes, | |||
| isUserLoggedIn() && isGLDLoggedIn() ? SettingRoutes : LoginRoutes, | |||
| isUserLoggedIn() && isGLDLoggedIn() ? GLDUserRoutes : LoginRoutes, | |||
| isUserLoggedIn() && isINDLoggedIn() || isUserLoggedIn() && isORGLoggedIn() ? PublicUserRoutes : LoginRoutes(), | |||
| isUserLoggedIn() && isGLDLoggedIn() ? SettingRoutes : LoginRoutes(), | |||
| isUserLoggedIn() && isGLDLoggedIn() ? GLDUserRoutes : LoginRoutes(), | |||
| !isUserLoggedIn() ? { | |||
| path: '*', | |||
| element: <Navigate to="/login" /> | |||
| @@ -12,6 +12,7 @@ export const PRIVACY_POLICY_PATH = apiPath+'/privacyPolicy'; | |||
| export const I_AM_SMART_PATH = apiPath+'/smart/call/iAmSmart'; | |||
| export const I_AM_SMART_APP_PATH = apiPath+'/smart/call/app/iAmSmart'; | |||
| export const GET_SYS_SETTING = apiPath+'/sys'; | |||
| //Group Config | |||
| export const GET_GROUP_LIST_PATH = apiPath+'/group'; | |||