|
|
@@ -33,6 +33,7 @@ import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; |
|
|
import axios from 'axios'; |
|
|
import axios from 'axios'; |
|
|
import { useParams,Link } from 'react-router-dom'; |
|
|
import { useParams,Link } from 'react-router-dom'; |
|
|
import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; |
|
|
import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; |
|
|
|
|
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
@@ -43,6 +44,7 @@ const Index = () => { |
|
|
const [showPassword, setShowPassword] = React.useState(false); |
|
|
const [showPassword, setShowPassword] = React.useState(false); |
|
|
const [showConfirmPassword, setshowConfirmPassword] = React.useState(false); |
|
|
const [showConfirmPassword, setshowConfirmPassword] = React.useState(false); |
|
|
const [isLoading, setLoding] = React.useState(true); |
|
|
const [isLoading, setLoding] = React.useState(true); |
|
|
|
|
|
/** null: loading; true: verified (show password form); false: link invalid/already used (HTTP 200, no username); 'error': network / server error */ |
|
|
const [verifyState, setVerifyState] = React.useState(null) |
|
|
const [verifyState, setVerifyState] = React.useState(null) |
|
|
const [enterUseEffect, setEnterUseEffect] = React.useState(false) |
|
|
const [enterUseEffect, setEnterUseEffect] = React.useState(false) |
|
|
const [username, setUsername] = React.useState("") |
|
|
const [username, setUsername] = React.useState("") |
|
|
@@ -75,14 +77,16 @@ const Index = () => { |
|
|
console.log(response) |
|
|
console.log(response) |
|
|
setUsername(response.data.username) |
|
|
setUsername(response.data.username) |
|
|
setVerifyState(true) |
|
|
setVerifyState(true) |
|
|
} else { |
|
|
|
|
|
|
|
|
} else if (response.status === 200) { |
|
|
setVerifyState(false) |
|
|
setVerifyState(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
setVerifyState('error') |
|
|
} |
|
|
} |
|
|
setLoding(false) |
|
|
setLoding(false) |
|
|
} |
|
|
} |
|
|
).catch(error => { |
|
|
).catch(error => { |
|
|
console.log(error) |
|
|
console.log(error) |
|
|
setVerifyState(false) |
|
|
|
|
|
|
|
|
setVerifyState('error') |
|
|
setLoding(false) |
|
|
setLoding(false) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@@ -215,7 +219,7 @@ const Index = () => { |
|
|
boxShadow |
|
|
boxShadow |
|
|
> |
|
|
> |
|
|
<form onSubmit={formik.handleSubmit}> |
|
|
<form onSubmit={formik.handleSubmit}> |
|
|
{verifyState ? |
|
|
|
|
|
|
|
|
{verifyState === true ? |
|
|
// SUCCESS page |
|
|
// SUCCESS page |
|
|
<Grid container spacing={4} sx={{ minHeight: {xs:"80vh", sm:"50vh", md: "50vh", lg:"70vh", xl:"50vh"} }} direction="column" justifyContent="flex-start" alignItems="center"> |
|
|
<Grid container spacing={4} sx={{ minHeight: {xs:"80vh", sm:"50vh", md: "50vh", lg:"70vh", xl:"50vh"} }} direction="column" justifyContent="flex-start" alignItems="center"> |
|
|
<Grid container direction="column" alignItems="center"> |
|
|
<Grid container direction="column" alignItems="center"> |
|
|
@@ -387,8 +391,27 @@ const Index = () => { |
|
|
</ThemeProvider> |
|
|
</ThemeProvider> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|
|
|
|
: verifyState === false ? |
|
|
|
|
|
// Link invalid or already used (same as Verify.js informational branch) |
|
|
|
|
|
<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,}}> |
|
|
|
|
|
<InfoOutlinedIcon color="info" sx={{ width: "200px", height: "200px" }} /> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={12} md={12} lg={12} sx={{ mb: 1, mt:5, ml:2}}> |
|
|
|
|
|
<Typography display="inline" variant="h4" sx={{textAlign: 'justify'}}> |
|
|
|
|
|
<FormattedMessage id="verifyInfo"/> |
|
|
|
|
|
</Typography> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={12} md={12} lg={12} sx={{ mb: 1, mt:5,}}> |
|
|
|
|
|
<Button variant="outlined" component={Link} to="/login" color="primary"> |
|
|
|
|
|
<Typography variant="h5"> |
|
|
|
|
|
<FormattedMessage id="backToLogin"/> |
|
|
|
|
|
</Typography> |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
</Grid> |
|
|
: |
|
|
: |
|
|
// ERROR page |
|
|
|
|
|
|
|
|
// ERROR page (network / server error) |
|
|
<Grid container spacing={4} sx={{ minHeight: {xs:"80vh", sm:"70vh", md: "70vh", lg:"70vh", xl:"50vh"} }} direction="column" justifyContent="flex-start" alignItems="center"> |
|
|
<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,}}> |
|
|
<Grid item xs={12} md={12} lg={12} sx={{ mb: 1, mt:5,}}> |
|
|
<CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} /> |
|
|
<CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} /> |
|
|
|