merge both code

This commit is contained in:
2025-07-09 16:43:33 +05:30
parent 893dcbc761
commit 9a02cff754
2 changed files with 43 additions and 100 deletions

View File

@@ -5,9 +5,10 @@ import { notifications } from "@mantine/notifications";
import { Providers } from "@/app/providers"; 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 myImage from '@/app/image/ebanking.jpg'; import logo from '@/app/image/logo.jpg';
import changePwdImage from '@/app/image/changepw.png'; import changePwdImage from '@/app/image/changepw.png';
import CaptchaImage from './CaptchaImage'; import CaptchaImage from './CaptchaImage';
import { IconEye, IconEyeOff } from '@tabler/icons-react';
export default function ChangeLoginPwd() { export default function ChangeLoginPwd() {
const router = useRouter(); const router = useRouter();
@@ -18,6 +19,10 @@ export default function ChangeLoginPwd() {
const [captchaInput, setCaptchaInput] = useState(''); const [captchaInput, setCaptchaInput] = useState('');
const [captchaError, setCaptchaError] = useState(''); const [captchaError, setCaptchaError] = useState('');
const [confirmVisible, setConfirmVisible] = useState(false);
const toggleConfirmVisibility = () => setConfirmVisible((v) => !v);
useEffect(() => { useEffect(() => {
generateCaptcha(); generateCaptcha();
}, []); }, []);
@@ -122,11 +127,16 @@ export default function ChangeLoginPwd() {
return ( return (
<Providers> <Providers>
<div style={{ backgroundColor: "#f8f9fa", width: "100%", height: "auto", paddingTop: "5%" }}> <div style={{ backgroundColor: "#f8f9fa", width: "100%", height: "auto", paddingTop: "5%" }}>
<Box style={{ position: 'fixed', width: '100%', height: '12%', top: 0, left: 0, zIndex: 100 }}> <Box style={{
position: 'fixed', width: '100%', height: '12%', top: 0, left: 0, zIndex: 100,
display: "flex",
justifyContent: "flex-start",
background: "linear-gradient(15deg,rgba(2, 163, 85, 1) 55%, rgba(101, 101, 184, 1) 100%)"
}}>
<Image <Image
// radius="md" // radius="md"
fit="cover" fit="cover"
src={myImage} src={logo}
component={NextImage} component={NextImage}
alt="ebanking" alt="ebanking"
style={{ width: "100%", height: "100%" }} style={{ width: "100%", height: "100%" }}
@@ -162,6 +172,16 @@ export default function ChangeLoginPwd() {
id="confirmPassword" id="confirmPassword"
value={confirmPassword} value={confirmPassword}
onChange={(e) => setConfirmPassword(e.currentTarget.value)} onChange={(e) => setConfirmPassword(e.currentTarget.value)}
type={confirmVisible ? 'text' : 'password'}
rightSection={
<button
type="button"
onClick={toggleConfirmVisibility}
style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'grey' }}
>
{confirmVisible ? <IconEyeOff size={18} /> : <IconEye size={18} />}
</button>
}
onCopy={(e) => e.preventDefault()} onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()} onPaste={(e) => e.preventDefault()}
onCut={(e) => e.preventDefault()} onCut={(e) => e.preventDefault()}

View File

@@ -12,27 +12,14 @@ import { IconEye, IconEyeOff } from '@tabler/icons-react';
export default function ChangeTransactionPwd() { export default function ChangeTransactionPwd() {
const router = useRouter(); const router = useRouter();
<<<<<<< HEAD
const [authorized, SetAuthorized] = useState<boolean | null>(null); const [authorized, SetAuthorized] = useState<boolean | null>(null);
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState("");
=======
const [error, setError] = useState<string | null>(null);
const [CIF, SetCIF] = useState("");
const [psw, SetPsw] = useState("");
//const [loginVisible, setLoginVisible] = useState(false);
const [confirmVisible, setConfirmVisible] = useState(false);
// const toggleLoginVisibility = () => setLoginVisible((v) => !v);
const toggleConfirmVisibility = () => setConfirmVisible((v) => !v);
>>>>>>> 293a7dbea0766fdf05804199800c4e3fd9174507
const [captcha, setCaptcha] = useState(""); const [captcha, setCaptcha] = useState("");
const [captchaInput, setCaptchaInput] = useState(''); const [captchaInput, setCaptchaInput] = useState('');
const [captchaError, setCaptchaError] = useState(''); const [captchaError, setCaptchaError] = useState('');
const [confirmVisible, setConfirmVisible] = useState(false);
const toggleConfirmVisibility = () => setConfirmVisible((v) => !v);
useEffect(() => { useEffect(() => {
generateCaptcha(); generateCaptcha();
@@ -123,7 +110,6 @@ export default function ChangeTransactionPwd() {
} }
} }
<<<<<<< HEAD
useEffect(() => { useEffect(() => {
const token = localStorage.getItem("access_token"); const token = localStorage.getItem("access_token");
if (!token) { if (!token) {
@@ -134,94 +120,21 @@ export default function ChangeTransactionPwd() {
SetAuthorized(true); SetAuthorized(true);
} }
}, []); }, []);
=======
return (
<Providers>
<div style={{ backgroundColor: "#f8f9fa", width: "100%", height: "auto", paddingTop: "5%" }}>
<Box style={{
position: 'fixed', width: '100%', height: '12%', top: 0, left: 0, zIndex: 100,
display: "flex",
justifyContent: "flex-start",
background: "linear-gradient(15deg,rgba(2, 163, 85, 1) 55%, rgba(101, 101, 184, 1) 100%)"
}}>
<Image
// radius="md"
fit="cover"
src={logo}
component={NextImage}
alt="ebanking"
style={{ width: "100%", height: "100%" }}
/>
</Box>
<div style={{ marginTop: '10px' }}>
<Box style={{ display: "flex", justifyContent: "center", alignItems: "center", columnGap: "5rem" }} bg="#c1e0f0">
<Image h="85vh" fit="contain" component={NextImage} src={changePwdImage} alt="Change Password Image" />
<Box h="100%" style={{ display: "flex", justifyContent: "center", alignItems: "center" }}>
<Card p="xl" w="35vw">
<Title order={3}
// @ts-ignore
align="center" mb="md">Set Transaction Password</Title>
<form>
<PasswordInput
label="Transaction Password"
placeholder="Enter your password"
required
id="loginPassword"
onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()}
onCut={(e) => e.preventDefault()}
/>
{/* <PasswordInput
label="Confirm Transaction Password"
placeholder="Enter your password"
required
id="confirmPassword"
onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()}
onCut={(e) => e.preventDefault()}
/> */}
<PasswordInput
mt="md"
label="Confirm Login Password"
placeholder="Enter your password"
required
id="confirmPassword"
value={psw}
onChange={(e) => SetPsw(e.currentTarget.value)}
type={confirmVisible ? 'text' : 'password'}
rightSection={
<button
type="button"
onClick={toggleConfirmVisibility}
style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'grey' }}
>
{confirmVisible ? <IconEyeOff size={18} /> : <IconEye size={18} />}
</button>
}
onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()}
onCut={(e) => e.preventDefault()}
/>
{/* <Button fullWidth mt="sm" color="blue" onClick={() => {
router.push("/login")
}} >
Set
</Button> */}
>>>>>>> 293a7dbea0766fdf05804199800c4e3fd9174507
if (authorized) { if (authorized) {
return ( return (
<Providers> <Providers>
<div style={{ backgroundColor: "#f8f9fa", width: "100%", height: "auto", paddingTop: "5%" }}> <div style={{ backgroundColor: "#f8f9fa", width: "100%", height: "auto", paddingTop: "5%" }}>
<Box style={{ position: 'fixed', width: '100%', height: '12%', top: 0, left: 0, zIndex: 100 }}> <Box style={{
position: 'fixed', width: '100%', height: '12%', top: 0, left: 0, zIndex: 100,
display: "flex",
justifyContent: "flex-start",
background: "linear-gradient(15deg,rgba(2, 163, 85, 1) 55%, rgba(101, 101, 184, 1) 100%)"
}}>
<Image <Image
// radius="md" // radius="md"
fit="cover" fit="cover"
src={myImage} src={logo}
component={NextImage} component={NextImage}
alt="ebanking" alt="ebanking"
style={{ width: "100%", height: "100%" }} style={{ width: "100%", height: "100%" }}
@@ -253,6 +166,16 @@ export default function ChangeTransactionPwd() {
required required
id="confirmPassword" id="confirmPassword"
value={confirmPassword} value={confirmPassword}
type={confirmVisible ? 'text' : 'password'}
rightSection={
<button
type="button"
onClick={toggleConfirmVisibility}
style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'grey' }}
>
{confirmVisible ? <IconEyeOff size={18} /> : <IconEye size={18} />}
</button>
}
onChange={(e) => setConfirmPassword(e.currentTarget.value)} onChange={(e) => setConfirmPassword(e.currentTarget.value)}
onCopy={(e) => e.preventDefault()} onCopy={(e) => e.preventDefault()}
onPaste={(e) => e.preventDefault()} onPaste={(e) => e.preventDefault()}