fix: change in password page

This commit is contained in:
2025-07-03 14:29:03 +05:30
parent 1efe8af7e6
commit 011df884d8
3 changed files with 121 additions and 100 deletions

View File

@@ -94,6 +94,8 @@ export default function Login() {
placeholder="Enter your password" placeholder="Enter your password"
required required
id="loginPassword" id="loginPassword"
value={password}
onChange={(e) => setPassword(e.currentTarget.value)}
onCopy={(e) => e.preventDefault()} onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()} onPaste={(e) => e.preventDefault()}
onCut={(e) => e.preventDefault()} onCut={(e) => e.preventDefault()}
@@ -157,6 +159,8 @@ export default function Login() {
else { else {
// If all checks pass // If all checks pass
localStorage.setItem("password",password);
localStorage.setItem("Tpin_setup","Y");
router.push("/ChangeTxn"); router.push("/ChangeTxn");
notifications.show({ notifications.show({
title: 'Password Change', title: 'Password Change',

View File

@@ -27,10 +27,7 @@ export default function Login() {
const [captchaInput, setCaptchaInput] = useState(''); const [captchaInput, setCaptchaInput] = useState('');
const [captchaError, setCaptchaError] = useState(''); const [captchaError, setCaptchaError] = useState('');
// const [isClient,SetIsClient] =useState(false); // const [isClient,SetIsClient] =useState(false);
// useEffect(()=> SetIsClient(true),[]); // useEffect(()=> SetIsClient(true),[]);
// useEffect(() => { // useEffect(() => {
// setCaptcha(generateCaptcha()); // setCaptcha(generateCaptcha());
// }, []); // }, []);
@@ -162,7 +159,7 @@ export default function Login() {
align="center" mb="md">Change Transaction Password</Title> align="center" mb="md">Change Transaction Password</Title>
<form> <form>
<PasswordInput <PasswordInput
label="Login Password" label="Transaction Password"
placeholder="Enter your password" placeholder="Enter your password"
required required
id="loginPassword" id="loginPassword"
@@ -171,7 +168,7 @@ export default function Login() {
onCut={(e) => e.preventDefault()} onCut={(e) => e.preventDefault()}
/> />
<PasswordInput <PasswordInput
label="Confirm Login Password" label="Confirm Transaction Password"
placeholder="Enter your password" placeholder="Enter your password"
required required
id="confirmPassword" id="confirmPassword"

View File

@@ -24,6 +24,8 @@ export default function Login() {
const [inputCaptcha, setInputCaptcha] = useState(""); const [inputCaptcha, setInputCaptcha] = useState("");
const [isLogging, setIsLogging] = useState(false); const [isLogging, setIsLogging] = useState(false);
const ClientCarousel = dynamic(() => import('./clientCarousel'), { ssr: false }); const ClientCarousel = dynamic(() => import('./clientCarousel'), { ssr: false });
localStorage.setItem("password", "SecurePass123!");
localStorage.setItem("Tpin_setup", "F");
useEffect(() => { useEffect(() => {
setCaptcha(generateCaptcha()); setCaptcha(generateCaptcha());
@@ -53,17 +55,24 @@ export default function Login() {
return; return;
} }
if (CIF === "30022497139" && psw === "SecurePass123!") { if (CIF === "30022497139" && psw === localStorage.getItem("password")) {
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30"; const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30";
localStorage.setItem("customerNumber", CIF); // localStorage.setItem("customerNumber", CIF);
localStorage.setItem("password", psw); // localStorage.setItem("password", psw);
// console.log("Tithi:", localStorage.getItem("password"));
console.log("Tithi:", localStorage.getItem("Tpin_setup"));
localStorage.setItem("access_token", token); localStorage.setItem("access_token", token);
setIsLogging(true); setIsLogging(true);
// if (localStorage.getItem("Tpin_setup") === 'F')
// router.push("/ChangePassword");
// else
router.push("/home"); router.push("/home");
} else { } else {
// SetCIF(''); // SetCIF('');
// SetPsw(''); // SetPsw('');
// setCaptcha(''); // setCaptcha('');
console.log("Tithi:", localStorage.getItem("password"));
console.log("Tithi:", localStorage.getItem("Tpin_setup"));
notifications.show({ notifications.show({
withBorder: true, withBorder: true,
color: "red", color: "red",
@@ -135,7 +144,7 @@ export default function Login() {
`} `}
</style> </style>
</Box> </Box>
<div style={{ display: "flex", height: "70vh", overflow: "hidden", position: "relative" }}> <div style={{ display: "flex", height: "75vh", overflow: "hidden", position: "relative" }}>
<div style={{ flex: 1, backgroundColor: "#c1e0f0", position: "relative" }}> <div style={{ flex: 1, backgroundColor: "#c1e0f0", position: "relative" }}>
<Image <Image
fit="cover" fit="cover"
@@ -145,7 +154,7 @@ export default function Login() {
style={{ width: "100%", height: "100%" }} style={{ width: "100%", height: "100%" }}
/> />
</div> </div>
<div {/* <div
style={{ style={{
flex: 1, flex: 1,
backgroundColor: "#c1e0f0", backgroundColor: "#c1e0f0",
@@ -154,32 +163,39 @@ export default function Login() {
alignItems: "center", alignItems: "center",
height: "100%" height: "100%"
}} }}
> > */}
<Card <Card
shadow="lg" shadow="lg"
padding="xl" padding="xl"
radius="md" radius="md"
style={{ style={{
width: "100%", flex: 1,
maxWidth: 480, display: "flex",
height: 380, justifyContent: "center",
marginTop: 0, alignItems: "center",
paddingTop: 5,
// width: "400%",
// maxWidth: 480,
// height: 400,
// marginTop: 0,
// paddingTop: 5,
backgroundColor: "#f0f0f0", backgroundColor: "#f0f0f0",
borderRadius: "12px", borderRadius: 0,
height: "100%",
boxShadow: "0 2px 10px rgba(228, 215, 215, 0.1)", boxShadow: "0 2px 10px rgba(228, 215, 215, 0.1)",
// border:"1px solid black"
}} }}
> >
<Stack gap="xs"> <Stack gap="xs" style={{ width: "100%", maxWidth: 480, marginTop: 0 }}>
<Title order={6} style={{ marginLeft: 10 }}> <Title order={6} style={{ marginLeft: 10, marginBottom: "8px" }}>
<Text fs="italic">Welcome To KCC Bank</Text> <Text fs="italic">Welcome To KCC Bank</Text>
<Text fw={700} style={{ fontSize: "18px", color: "#000066" }}>Internet Banking</Text> <Text fw={700} style={{ fontSize: "18px", color: "#000066" }}>Internet Banking</Text>
</Title> </Title>
<Box <Box
style={{ style={{
width: 370, // width: 370,
marginTop: 0, marginTop: 0,
paddingTop: 5, // paddingTop: 5,
padding: "10px", padding: "10px",
border: "1px solid #e0e0d1", border: "1px solid #e0e0d1",
}} }}
@@ -187,9 +203,9 @@ export default function Login() {
<Flex justify="center" gap="md"> <Flex justify="center" gap="md">
<form onSubmit={handleLogin}> <form onSubmit={handleLogin}>
<TextInput <TextInput
size="xs" size="md"
label="User ID" label="User ID"
placeholder="Enter your CIF no" placeholder="Enter your CIF No"
type="text" type="text"
inputMode="numeric" inputMode="numeric"
value={CIF} value={CIF}
@@ -205,20 +221,24 @@ export default function Login() {
<PasswordInput <PasswordInput
label="Password" label="Password"
size="xs" size="md"
placeholder="Enter your password" placeholder="Enter your password"
value={psw} value={psw}
onChange={(e) => SetPsw(e.currentTarget.value)} onChange={(e) => SetPsw(e.currentTarget.value)}
required required
/> />
<Group > <Group mt="xs" align="center" gap="xs" >
<Box <Box
style={{ style={{
padding: "5px 5px", // padding: "5px",
backgroundColor: "#ffffff", alignItems: "center",
backgroundColor: "#fff",
fontFamily: "'UnifrakturCook',cursive", fontFamily: "'UnifrakturCook',cursive",
textDecoration: "line-through", textDecoration: "line-through",
fontSize: "16px",
userSelect: "none", userSelect: "none",
display: "flex",
width: "30%"
}} }}
> >
{captcha} {captcha}
@@ -229,7 +249,7 @@ export default function Login() {
</Group> </Group>
<TextInput <TextInput
label="Enter CAPTCHA" label="Enter CAPTCHA"
size="xs" size="md"
placeholder="Enter above text" placeholder="Enter above text"
value={inputCaptcha} value={inputCaptcha}
onChange={(e) => setInputCaptcha(e.currentTarget.value)} onChange={(e) => setInputCaptcha(e.currentTarget.value)}
@@ -237,14 +257,14 @@ export default function Login() {
/> />
<Button type="submit" disabled={isLogging} fullWidth variant="filled" mt="md"> <Button type="submit" disabled={isLogging} fullWidth variant="filled" mt="md">
{/* Login */} {/* Login */}
{isLogging ? "Logging.." :"Login"} {isLogging ? "Logging.." : "Login"}
</Button> </Button>
</form> </form>
</Flex> </Flex>
</Box> </Box>
</Stack> </Stack>
</Card> </Card>
</div> {/* </div> */}
</div> </div>
<Box style={{ <Box style={{
width: "100%", width: "100%",