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

View File

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

View File

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