feat : api integrated change login password and change transaction password
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/package-lock.json
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.js
|
.pnp.js
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
|
4688
package-lock.json
generated
4688
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,31 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { TextInput, PasswordInput, Button, Title, Paper, Group, Box } from "@mantine/core";
|
import { TextInput, PasswordInput, Button, Title, Paper, Group, Box, Text } from "@mantine/core";
|
||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import { IconLock } from "@tabler/icons-react";
|
import { IconLock } from "@tabler/icons-react";
|
||||||
import { generateCaptcha } from "@/app/captcha";
|
import { generateCaptcha } from "@/app/captcha";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function ChangePassword() {
|
export default function ChangePassword() {
|
||||||
|
const router = useRouter();
|
||||||
const [oldPassword, setOldPassword] = useState("");
|
const [oldPassword, setOldPassword] = useState("");
|
||||||
const [newPassword, setNewPassword] = useState("");
|
const [newPassword, setNewPassword] = useState("");
|
||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
const [captcha, setCaptcha] = useState("");
|
const [captcha, setCaptcha] = useState("");
|
||||||
const [captchaInput, setCaptchaInput] = useState("");
|
const [captchaInput, setCaptchaInput] = useState("");
|
||||||
const [otp, setOtp] = useState("");
|
const [otp, setOtp] = useState("");
|
||||||
|
const [generatedOtp, setGeneratedOtp] = useState('');
|
||||||
const [otpValidated, setOtpValidated] = useState(false);
|
const [otpValidated, setOtpValidated] = useState(false);
|
||||||
|
const [step, setStep] = useState<"form" | "otp" | "final">("form");
|
||||||
const [step, setStep] = useState<"form" | "otp" | "final">("form"); // ✅ steps control
|
|
||||||
const [passwordHistory] = useState(["Pass@1234", "OldPass@123", "MyPass#2023"]);
|
|
||||||
const icon = <IconLock size={18} stroke={1.5} />;
|
const icon = <IconLock size={18} stroke={1.5} />;
|
||||||
|
|
||||||
|
const handleGenerateOtp = async () => {
|
||||||
|
const value = "123456"; // Or generate a random OTP
|
||||||
|
setGeneratedOtp(value);
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
regenerateCaptcha();
|
regenerateCaptcha();
|
||||||
}, []);
|
}, []);
|
||||||
@@ -33,7 +40,7 @@ export default function ChangePassword() {
|
|||||||
return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/.test(password);
|
return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/.test(password);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = async () => {
|
||||||
// Step 1 → validate form
|
// Step 1 → validate form
|
||||||
if (step === "form") {
|
if (step === "form") {
|
||||||
if (!oldPassword || !newPassword || !confirmPassword || !captchaInput) {
|
if (!oldPassword || !newPassword || !confirmPassword || !captchaInput) {
|
||||||
@@ -44,36 +51,14 @@ export default function ChangePassword() {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const actualOldPassword = "Pass@123";
|
|
||||||
if (oldPassword !== actualOldPassword) {
|
|
||||||
notifications.show({
|
|
||||||
title: "Old Password Incorrect",
|
|
||||||
message: "Entered old password does not match.",
|
|
||||||
color: "red",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!validatePasswordPolicy(newPassword)) {
|
if (!validatePasswordPolicy(newPassword)) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Invalid Password",
|
title: "Invalid Password",
|
||||||
message:
|
message: "Password must contain at least one capital letter(A-Z), one digit(0-9), one special symbol(e.g.,@,#,$), and be 8-15 characters long.",
|
||||||
"Password must be at least 8 characters and contain alphanumeric and special characters.",
|
|
||||||
color: "red",
|
color: "red",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passwordHistory.includes(newPassword)) {
|
|
||||||
notifications.show({
|
|
||||||
title: "Password Reused",
|
|
||||||
message: "New password must be different from the last 3 passwords.",
|
|
||||||
color: "red",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newPassword !== confirmPassword) {
|
if (newPassword !== confirmPassword) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Password Mismatch",
|
title: "Password Mismatch",
|
||||||
@@ -82,7 +67,6 @@ export default function ChangePassword() {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (captchaInput !== captcha) {
|
if (captchaInput !== captcha) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Invalid Captcha",
|
title: "Invalid Captcha",
|
||||||
@@ -93,7 +77,8 @@ export default function ChangePassword() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ Passed → move to OTP
|
// Passed → move to OTP
|
||||||
|
await handleGenerateOtp();
|
||||||
setStep("otp");
|
setStep("otp");
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "OTP Sent",
|
title: "OTP Sent",
|
||||||
@@ -105,7 +90,7 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
// Step 2 → validate OTP
|
// Step 2 → validate OTP
|
||||||
if (step === "otp") {
|
if (step === "otp") {
|
||||||
if (otp !== "123456") {
|
if (otp !== generatedOtp) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Invalid OTP",
|
title: "Invalid OTP",
|
||||||
message: "Please enter the correct OTP.",
|
message: "Please enter the correct OTP.",
|
||||||
@@ -126,12 +111,55 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
// Step 3 → Final Change Password
|
// Step 3 → Final Change Password
|
||||||
if (step === "final") {
|
if (step === "final") {
|
||||||
|
const token = localStorage.getItem("access_token");
|
||||||
|
if (!token) {
|
||||||
|
router.push("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/auth/change/login_password", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
OldLPsw: oldPassword,
|
||||||
|
newLPsw: newPassword,
|
||||||
|
confirmLPsw: confirmPassword
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.status === 401) {
|
||||||
|
localStorage.removeItem("access_token");
|
||||||
|
router.push("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const result = await response.json();
|
||||||
|
console.log(result);
|
||||||
|
if (!response.ok) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Password Changed",
|
title: "Failed",
|
||||||
message: "Your password has been successfully updated.",
|
message: result.error || "Failed to set login password",
|
||||||
|
color: "Red",
|
||||||
|
autoClose: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (response.ok) {
|
||||||
|
notifications.show({
|
||||||
|
title: "Success",
|
||||||
|
message: "Login password Change successfully.",
|
||||||
color: "green",
|
color: "green",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
resetForm();
|
resetForm();
|
||||||
|
} catch (err: any) {
|
||||||
|
notifications.show({
|
||||||
|
title: "Error",
|
||||||
|
message: err.message || "Server error, please try again later",
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,12 +176,12 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper shadow="sm" radius="md" p="md" withBorder h={400}>
|
<Paper shadow="sm" radius="md" p="md" withBorder h={400}>
|
||||||
<Title order={3} style={{color:"red"}}>More Updates comming soon .....</Title>
|
|
||||||
<Title order={3} mb="sm">
|
<Title order={3} mb="sm">
|
||||||
Change Login Password
|
Change Login Password
|
||||||
</Title>
|
</Title>
|
||||||
{/* Scrollable form area */}
|
{/* Scrollable form area */}
|
||||||
<div style={{ overflowY: "auto", maxHeight: "280px", paddingRight: 8 }}>
|
<div style={{ overflowY: "auto", maxHeight: "280px" }}>
|
||||||
|
<Group grow>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
label="Old Password"
|
label="Old Password"
|
||||||
placeholder="Enter old password"
|
placeholder="Enter old password"
|
||||||
@@ -163,13 +191,14 @@ export default function ChangePassword() {
|
|||||||
mb="xs"
|
mb="xs"
|
||||||
readOnly={step !== "form"}
|
readOnly={step !== "form"}
|
||||||
/>
|
/>
|
||||||
<Group grow>
|
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
label="New Password"
|
label="New Password"
|
||||||
placeholder="Enter new password"
|
placeholder="Enter new password"
|
||||||
value={newPassword}
|
value={newPassword}
|
||||||
onChange={(e) => setNewPassword(e.currentTarget.value)}
|
onChange={(e) => setNewPassword(e.currentTarget.value)}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
|
minLength={8}
|
||||||
|
maxLength={15}
|
||||||
mb="xs"
|
mb="xs"
|
||||||
readOnly={step !== "form"}
|
readOnly={step !== "form"}
|
||||||
/>
|
/>
|
||||||
@@ -187,11 +216,8 @@ export default function ChangePassword() {
|
|||||||
onPaste={(e) => e.preventDefault()}
|
onPaste={(e) => e.preventDefault()}
|
||||||
onCut={(e) => e.preventDefault()}
|
onCut={(e) => e.preventDefault()}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
{/* CAPTCHA */}
|
{/* CAPTCHA */}
|
||||||
|
|
||||||
<div style={{ marginTop: 5 }}>
|
<div style={{ marginTop: 5 }}>
|
||||||
<label style={{ display: "block", marginBottom: 4, fontSize: "14px" }}>
|
<label style={{ display: "block", marginBottom: 4, fontSize: "14px" }}>
|
||||||
|
|
||||||
@@ -246,10 +272,6 @@ export default function ChangePassword() {
|
|||||||
readOnly={otpValidated}
|
readOnly={otpValidated}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Buttons */}
|
|
||||||
<Group mt="md" gap="sm">
|
<Group mt="md" gap="sm">
|
||||||
<Button onClick={handleSubmit}>
|
<Button onClick={handleSubmit}>
|
||||||
{step === "form" && "Submit"}
|
{step === "form" && "Submit"}
|
||||||
@@ -260,6 +282,10 @@ export default function ChangePassword() {
|
|||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
</div>
|
||||||
|
<Text size="sm" c="dimmed" style={{ marginTop: "40px" }}>
|
||||||
|
Note: Your new password must be 8–15 characters long and contain at least one number and one special character.
|
||||||
|
</Text>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -5,20 +5,27 @@ import { TextInput, PasswordInput, Button, Title, Paper, Group, Box } from "@man
|
|||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import { IconLock } from "@tabler/icons-react";
|
import { IconLock } from "@tabler/icons-react";
|
||||||
import { generateCaptcha } from "@/app/captcha";
|
import { generateCaptcha } from "@/app/captcha";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function ChangePassword() {
|
export default function ChangePassword() {
|
||||||
|
const router = useRouter();
|
||||||
const [oldPassword, setOldPassword] = useState("");
|
const [oldPassword, setOldPassword] = useState("");
|
||||||
const [newPassword, setNewPassword] = useState("");
|
const [newPassword, setNewPassword] = useState("");
|
||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
const [captcha, setCaptcha] = useState("");
|
const [captcha, setCaptcha] = useState("");
|
||||||
const [captchaInput, setCaptchaInput] = useState("");
|
const [captchaInput, setCaptchaInput] = useState("");
|
||||||
const [otp, setOtp] = useState("");
|
const [otp, setOtp] = useState("");
|
||||||
|
const [generatedOtp, setGeneratedOtp] = useState('');
|
||||||
const [otpValidated, setOtpValidated] = useState(false);
|
const [otpValidated, setOtpValidated] = useState(false);
|
||||||
|
const [step, setStep] = useState<"form" | "otp" | "final">("form");
|
||||||
const [step, setStep] = useState<"form" | "otp" | "final">("form"); // ✅ steps control
|
|
||||||
const [passwordHistory] = useState(["Pass@1234", "OldPass@123", "MyPass#2023"]);
|
|
||||||
const icon = <IconLock size={18} stroke={1.5} />;
|
const icon = <IconLock size={18} stroke={1.5} />;
|
||||||
|
|
||||||
|
const handleGenerateOtp = async () => {
|
||||||
|
const value = "123456"; // Or generate a random OTP
|
||||||
|
setGeneratedOtp(value);
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
regenerateCaptcha();
|
regenerateCaptcha();
|
||||||
}, []);
|
}, []);
|
||||||
@@ -33,7 +40,7 @@ export default function ChangePassword() {
|
|||||||
return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/.test(password);
|
return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/.test(password);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = async () => {
|
||||||
// Step 1 → validate form
|
// Step 1 → validate form
|
||||||
if (step === "form") {
|
if (step === "form") {
|
||||||
if (!oldPassword || !newPassword || !confirmPassword || !captchaInput) {
|
if (!oldPassword || !newPassword || !confirmPassword || !captchaInput) {
|
||||||
@@ -44,36 +51,15 @@ export default function ChangePassword() {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const actualOldPassword = "Pass@123";
|
|
||||||
if (oldPassword !== actualOldPassword) {
|
|
||||||
notifications.show({
|
|
||||||
title: "Old Password Incorrect",
|
|
||||||
message: "Entered old password does not match.",
|
|
||||||
color: "red",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!validatePasswordPolicy(newPassword)) {
|
if (!validatePasswordPolicy(newPassword)) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Invalid Password",
|
title: "Invalid Password",
|
||||||
message:
|
message:
|
||||||
"Password must be at least 8 characters and contain alphanumeric and special characters.",
|
"Your new password must be 8–15 characters long and contain at least one number and one special character.",
|
||||||
color: "red",
|
color: "red",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passwordHistory.includes(newPassword)) {
|
|
||||||
notifications.show({
|
|
||||||
title: "Password Reused",
|
|
||||||
message: "New password must be different from the last 3 passwords.",
|
|
||||||
color: "red",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newPassword !== confirmPassword) {
|
if (newPassword !== confirmPassword) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Password Mismatch",
|
title: "Password Mismatch",
|
||||||
@@ -94,6 +80,7 @@ export default function ChangePassword() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ✅ Passed → move to OTP
|
// ✅ Passed → move to OTP
|
||||||
|
await handleGenerateOtp();
|
||||||
setStep("otp");
|
setStep("otp");
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "OTP Sent",
|
title: "OTP Sent",
|
||||||
@@ -105,7 +92,7 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
// Step 2 → validate OTP
|
// Step 2 → validate OTP
|
||||||
if (step === "otp") {
|
if (step === "otp") {
|
||||||
if (otp !== "123456") {
|
if (otp !== generatedOtp) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Invalid OTP",
|
title: "Invalid OTP",
|
||||||
message: "Please enter the correct OTP.",
|
message: "Please enter the correct OTP.",
|
||||||
@@ -126,12 +113,55 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
// Step 3 → Final Change Password
|
// Step 3 → Final Change Password
|
||||||
if (step === "final") {
|
if (step === "final") {
|
||||||
|
const token = localStorage.getItem("access_token");
|
||||||
|
if (!token) {
|
||||||
|
router.push("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/auth/change/transaction_password", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
OldTPsw: oldPassword,
|
||||||
|
newTPsw: newPassword,
|
||||||
|
confirmTPsw: confirmPassword
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.status === 401) {
|
||||||
|
localStorage.removeItem("access_token");
|
||||||
|
router.push("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const result = await response.json();
|
||||||
|
console.log(result);
|
||||||
|
if (!response.ok) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Password Changed",
|
title: "Failed",
|
||||||
message: "Your password has been successfully updated.",
|
message: result.error || "Failed to set transaction password",
|
||||||
|
color: "Red",
|
||||||
|
autoClose: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (response.ok) {
|
||||||
|
notifications.show({
|
||||||
|
title: "Success",
|
||||||
|
message: "Transaction password change successfully.",
|
||||||
color: "green",
|
color: "green",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
resetForm();
|
resetForm();
|
||||||
|
} catch (err: any) {
|
||||||
|
notifications.show({
|
||||||
|
title: "Error",
|
||||||
|
message: err.message || "Server error, please try again later",
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,7 +178,6 @@ export default function ChangePassword() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper shadow="sm" radius="md" p="md" withBorder h={400}>
|
<Paper shadow="sm" radius="md" p="md" withBorder h={400}>
|
||||||
<Title order={3} style={{color:"red"}}>More Updates comming soon .....</Title>
|
|
||||||
<Title order={3} mb="sm">
|
<Title order={3} mb="sm">
|
||||||
Change Transaction Password
|
Change Transaction Password
|
||||||
</Title>
|
</Title>
|
||||||
|
@@ -135,7 +135,6 @@ export default function ChangePassword() {
|
|||||||
router.push("/login");
|
router.push("/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/auth/transaction_password", {
|
const response = await fetch("/api/auth/transaction_password", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -196,8 +195,8 @@ export default function ChangePassword() {
|
|||||||
<div style={{ overflowY: "auto", maxHeight: "280px", paddingRight: 8 }}>
|
<div style={{ overflowY: "auto", maxHeight: "280px", paddingRight: 8 }}>
|
||||||
<Group grow>
|
<Group grow>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
label="New Password"
|
label="New Transaction Password"
|
||||||
placeholder="Enter new password"
|
placeholder="Enter new Transaction password"
|
||||||
value={newPassword}
|
value={newPassword}
|
||||||
onChange={(e) => setNewPassword(e.currentTarget.value)}
|
onChange={(e) => setNewPassword(e.currentTarget.value)}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
|
@@ -9,15 +9,18 @@ import kccb from "@/app/image/bank_logo/kccb.jpg";
|
|||||||
import logo from "@/app/image/bank_logo/bank.jpg";
|
import logo from "@/app/image/bank_logo/bank.jpg";
|
||||||
|
|
||||||
export function getBankLogo(bankName: string): StaticImageData {
|
export function getBankLogo(bankName: string): StaticImageData {
|
||||||
const logos: Record<string, StaticImageData> = {
|
if (!bankName) return logo;
|
||||||
"STATE BANK": sbi,
|
|
||||||
"PUNJAB NATIONAL": pnb,
|
|
||||||
"HDFC": hdfc,
|
|
||||||
"ICICI": icici,
|
|
||||||
"AXIS": axis,
|
|
||||||
"BANK OF INDIA": BOI,
|
|
||||||
"KANGRA": kccb,
|
|
||||||
};
|
|
||||||
|
|
||||||
return logos[bankName.toUpperCase()] ?? logo;
|
const upperName = bankName.toUpperCase();
|
||||||
|
|
||||||
|
if (upperName.startsWith("HDFC")) return hdfc;
|
||||||
|
if (upperName.startsWith("SBI") || upperName.startsWith("STATE BANK")) return sbi;
|
||||||
|
if (upperName.startsWith("ICICI")) return icici;
|
||||||
|
if (upperName.startsWith("PNB") || upperName.startsWith("PUNJAB NATIONAL")) return pnb;
|
||||||
|
if (upperName.startsWith("AXIS")) return axis;
|
||||||
|
if (upperName.startsWith("THE KANGRA CENTRAL")) return kccb;
|
||||||
|
if (upperName.startsWith("BANK OF INDIA") || upperName.startsWith("BOI")) return BOI;
|
||||||
|
|
||||||
|
return logo;
|
||||||
}
|
}
|
||||||
|
|
@@ -86,8 +86,6 @@ export default function UserConfiguration() {
|
|||||||
else {
|
else {
|
||||||
const rightsData = {
|
const rightsData = {
|
||||||
CIF,
|
CIF,
|
||||||
// internetBanking,
|
|
||||||
// mobileBanking,
|
|
||||||
};
|
};
|
||||||
console.log('Submitting rights:', rightsData);
|
console.log('Submitting rights:', rightsData);
|
||||||
notifications.show({
|
notifications.show({
|
||||||
|
BIN
src/app/image/ib_front_1.jpg
Normal file
BIN
src/app/image/ib_front_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
@@ -6,7 +6,7 @@ import { Providers } from "@/app/providers";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import NextImage from "next/image";
|
import NextImage from "next/image";
|
||||||
import logo from '@/app/image/logo1.jpg';
|
import logo from '@/app/image/logo1.jpg';
|
||||||
import frontPage from '@/app/image/ib_front.jpg';
|
import frontPage from '@/app/image/ib_front_1.jpg';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import { generateCaptcha } from '@/app/captcha';
|
import { generateCaptcha } from '@/app/captcha';
|
||||||
import { IconShieldLockFilled } from "@tabler/icons-react";
|
import { IconShieldLockFilled } from "@tabler/icons-react";
|
||||||
@@ -95,20 +95,20 @@ export default function Login() {
|
|||||||
password: psw,
|
password: psw,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const data = await response.json();
|
||||||
|
console.log(data);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
withBorder: true,
|
withBorder: true,
|
||||||
color: "red",
|
color: "red",
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: "Internal Server Error",
|
message: data?.error || "Internal Server Error",
|
||||||
autoClose: 5000,
|
autoClose: 5000,
|
||||||
});
|
});
|
||||||
localStorage.removeItem("access_token");
|
localStorage.removeItem("access_token");
|
||||||
localStorage.removeItem("remitter_name");
|
localStorage.removeItem("remitter_name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const data = await response.json();
|
|
||||||
console.log(data);
|
|
||||||
setIsLogging(true);
|
setIsLogging(true);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
Reference in New Issue
Block a user