diff --git a/src/pages/authentication/ForgotPassword/AuthCallback/index.js b/src/pages/authentication/ForgotPassword/AuthCallback/index.js index 9a17543..0a636a6 100644 --- a/src/pages/authentication/ForgotPassword/AuthCallback/index.js +++ b/src/pages/authentication/ForgotPassword/AuthCallback/index.js @@ -33,6 +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 InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -43,6 +44,7 @@ const Index = () => { const [showPassword, setShowPassword] = React.useState(false); const [showConfirmPassword, setshowConfirmPassword] = React.useState(false); 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 [enterUseEffect, setEnterUseEffect] = React.useState(false) const [username, setUsername] = React.useState("") @@ -75,14 +77,16 @@ const Index = () => { console.log(response) setUsername(response.data.username) setVerifyState(true) - } else { + } else if (response.status === 200) { setVerifyState(false) + } else { + setVerifyState('error') } setLoding(false) } ).catch(error => { console.log(error) - setVerifyState(false) + setVerifyState('error') setLoding(false) }); @@ -215,7 +219,7 @@ const Index = () => { boxShadow >