Merge branch 'Kartik_Task#470' into Issue_Jun_1W_2
This commit is contained in:
commit
40f4f2f254
@ -56,6 +56,9 @@ const Header = () => {
|
|||||||
const handleProfilePage = () => {
|
const handleProfilePage = () => {
|
||||||
navigate(`/employee/${profile?.employeeInfo?.id}?for=attendance`);
|
navigate(`/employee/${profile?.employeeInfo?.id}?for=attendance`);
|
||||||
};
|
};
|
||||||
|
const ChangePasswordPage = () => {
|
||||||
|
navigate(`/auth/changepassword`);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<nav
|
<nav
|
||||||
className="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme"
|
className="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme"
|
||||||
@ -620,6 +623,15 @@ const Header = () => {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
</li>
|
||||||
|
<li onClick={ChangePasswordPage}>
|
||||||
|
<a
|
||||||
|
aria-label="go to profile"
|
||||||
|
className="dropdown-item cusor-pointer"
|
||||||
|
>
|
||||||
|
<i className="bx bx-user me-2"></i>
|
||||||
|
<span className="align-middle">Change Password</span>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div className="dropdown-divider"></div>
|
<div className="dropdown-divider"></div>
|
||||||
|
@ -35,9 +35,10 @@ const resetPasswordSchema = z
|
|||||||
|
|
||||||
const ResetPasswordPage = () => {
|
const ResetPasswordPage = () => {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [ loading, setLoading ] = useState( false );
|
const [loading, setLoading] = useState(false);
|
||||||
const [hidepass, setHidepass] = useState(true);
|
const [hidepass, setHidepass] = useState(true);
|
||||||
const [hidepass1, setHidepass1] = useState(true);
|
const [hidepass1, setHidepass1] = useState(true);
|
||||||
|
const [tokenExpired, setTokenExpired] = useState(false);
|
||||||
|
|
||||||
const token = searchParams.get("token");
|
const token = searchParams.get("token");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -63,13 +64,28 @@ const ResetPasswordPage = () => {
|
|||||||
let response = await AuthRepository.resetPassword(reqObject);
|
let response = await AuthRepository.resetPassword(reqObject);
|
||||||
showToast("Password Reseted", "success");
|
showToast("Password Reseted", "success");
|
||||||
clearAllCache();
|
clearAllCache();
|
||||||
setLoading(false);
|
|
||||||
navigate("/auth/login", { replace: true });
|
navigate("/auth/login", { replace: true });
|
||||||
|
// setLoading(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false);
|
|
||||||
showToast("Token is expries or Invalid ", "error");
|
showToast("Token is expries or Invalid ", "error");
|
||||||
|
setTokenExpired(true);
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (tokenExpired) {
|
||||||
|
return (
|
||||||
|
<AuthWrapper>
|
||||||
|
<h4 className="mb-2 text-secondary">Session Expired 🔒</h4>
|
||||||
|
<p className="mb-4">Your session has expired or token is invalid.</p>
|
||||||
|
<div className="text-center mb-4">
|
||||||
|
<Link to="/auth/forgot-password" className="btn btn-outline-primary">
|
||||||
|
Go to Forgot Password
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</AuthWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<AuthWrapper>
|
<AuthWrapper>
|
||||||
<h4 className="mb-2">Reset Password? 🔒</h4>
|
<h4 className="mb-2">Reset Password? 🔒</h4>
|
||||||
@ -126,7 +142,7 @@ const ResetPasswordPage = () => {
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderBottomLeftRadius: 0,
|
borderBottomLeftRadius: 0,
|
||||||
borderLeft: 0,
|
borderLeft: 0,
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{hidepass ? (
|
{hidepass ? (
|
||||||
@ -161,7 +177,7 @@ const ResetPasswordPage = () => {
|
|||||||
placeholder="············"
|
placeholder="············"
|
||||||
aria-describedby="password"
|
aria-describedby="password"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn border-top border-end border-bottom "
|
className="btn border-top border-end border-bottom "
|
||||||
onClick={() => setHidepass1(!hidepass1)}
|
onClick={() => setHidepass1(!hidepass1)}
|
||||||
@ -169,7 +185,7 @@ const ResetPasswordPage = () => {
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderBottomLeftRadius: 0,
|
borderBottomLeftRadius: 0,
|
||||||
borderLeft: 0,
|
borderLeft: 0,
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{hidepass1 ? (
|
{hidepass1 ? (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user