feat: Password Expiry logic

This commit is contained in:
2025-10-08 10:40:37 +05:30
parent 050244291a
commit 2f45aba4d1
3 changed files with 427 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import frontPage from '@/app/image/ib_front_1.jpg';
import dynamic from 'next/dynamic';
import { generateCaptcha } from '@/app/captcha';
import { IconShieldLockFilled } from "@tabler/icons-react";
import dayjs from "dayjs";
export default function Login() {
const router = useRouter();
@@ -141,6 +142,24 @@ export default function Login() {
const token = data.token;
localStorage.setItem("access_token", token);
localStorage.setItem("pswExpiryDate", data.loginPswExpiry);
// Password Expiry Logic todo
if (data.loginPswExpiry && (dayjs(data.loginPswExpiry)).diff(dayjs(), "day") < 0) {
notifications.show({
withBorder: true,
color: "orange",
title: "Password Expired",
message: "Your password has expired, please set a new one.",
autoClose: 4000,
});
router.push("/ChangePassword");
return;
}
if (data.FirstTimeLogin === true) {
router.push("/SetPassword")
}