Production code

feat : 2 factor authentication , OTP service , Session timeout
This commit is contained in:
2025-10-15 11:50:25 +05:30
parent 569e31bf12
commit ad19f0cb4c
7 changed files with 62 additions and 40 deletions

View File

@@ -7,4 +7,23 @@
- npm run build - npm run build
- npm run start - npm run start
- npm run dev - npm run dev
## URls
- For user
```
http://localhost:3000/login
```
- For admin
```
http://localhost:3000/administrator/login
```
- For E-mandate
```
http://localhost:3000/eMandate/login
```

View File

@@ -15,8 +15,8 @@
- Limit of transaction daily --Asif - Limit of transaction daily --Asif
- >Statement Download - >Statement Download
- >In Every OTP page "Resend button" & 3 min timing of expiry. - >In Every OTP page "Resend button" & 3 min timing of expiry.
- OTP binding with actual mobile number. - >OTP binding with actual mobile number.
- Beneficiary delete feature - >Beneficiary delete feature
- IN settings page NOTE position Fixing. - IN settings page NOTE position Fixing.
- >Admin page - >Admin page
- >give rights - >give rights
@@ -27,7 +27,7 @@
<!-- - Make every page responsive (need to check settings and payment tab) --> <!-- - Make every page responsive (need to check settings and payment tab) -->
- Locked (3 times wrong password in time of login) - Locked (3 times wrong password in time of login)
- >session timeout - >session timeout
- login time otp - >login time otp
<!-- - narration (in statement) Last 10 transaction the remarks not comes from subham sites--> <!-- - narration (in statement) Last 10 transaction the remarks not comes from subham sites-->

View File

@@ -11,29 +11,31 @@ ____________________________________________________________
<!-- IB is the service name --> <!-- IB is the service name -->
- vi IB.service - vi IB.service
``` ```
[Unit] [Unit]
Description= Internet Banking Frontened Application in Node Description= Internet Banking Frontened Application in Node
After=network.target After=network.target
[Service] [Service]
# Use absolute path for node or npm # Use absolute path for node or npm
User=ib User=ib_new
Group=ib Group=ib_new
ExecStart=/usr/bin/npm start WorkingDirectory=/home/ib_new/IB
WorkingDirectory=/home/ib/IB Environment=PATH=/home/ib_new/.local/bin:/home/ib_new/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/opt/node-v20.19.5-linux-x64/bin
Restart=on-failure ExecStart=/opt/node-v20.19.5-linux-x64/bin/npm start
RestartSec=5 Restart=on-failure
Environment=NODE_ENV=production RestartSec=5
Environment=PORT=3000 Environment=NODE_ENV=production
SuccessExitStatus=143 Environment=PORT=3000
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target [Install]
WantedBy=multi-user.target
<All value are changed as per domain> <All value are changed as per domain>
``` ```
- sudo systemctl status IB - sudo systemctl status IB
- sudo systemctl start IB - sudo systemctl start IB
- sudo journalctl -u IB
- sudo systemctl stop IB - sudo systemctl stop IB
- sudo systemctl restart IB - sudo systemctl restart IB
@@ -44,7 +46,9 @@ ____________________________________________________________
UAT (IB- frontend Test) : i-0b55435e15425f1c3 UAT (IB- frontend Test) : i-0b55435e15425f1c3
Linux : i-0c850dcf8b85b1447 (Test) Linux : i-0c850dcf8b85b1447 (Test)
Prod : i-088e64c3435cb5078 (For IB & MB) # Prod : i-088e64c3435cb5078 (For IB & MB) --old
Prod : i-070a81f88a984f7c6 (For IB and MB)
Mobile banking Prod DB: i-086d4cb13afc2cd83 //IB user: ib_new psw: ib_new
``` ```
## 2. list of Port : ## 2. list of Port :

View File

@@ -1,4 +1,8 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
import os from "os";
const isWindows = os.platform() === "win32";
const nextConfig = { const nextConfig = {
experimental: { experimental: {
serverComponentsExternalPackages: ["typeorm", "knex"], serverComponentsExternalPackages: ["typeorm", "knex"],
@@ -6,15 +10,12 @@ const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
// For port transfer // For port transfer
async rewrites() { async rewrites() {
return[ return [
{ {
source:'/api/:path*', source: '/api/:path*',
destination: 'http://localhost:8080/api/:path*', destination: isWindows
// prod ? "http://localhost:8080/api/:path*" // For Windows
// destination : 'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com:8080/api/:path*', : "https://kccbmbnk.net/api/:path*", // For Linux/Mac/Server
// Testing
// destination: 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080/api/:path*',
}, },
]; ];
}, },

View File

@@ -19,7 +19,7 @@ export default function ValidateUser() {
const headerRef = useRef<HTMLHeadingElement>(null); const headerRef = useRef<HTMLHeadingElement>(null);
const validUsers = [ const validUsers = [
{ cif: "11111111111", mobile: "6297421727" }, { cif: "11111111111", mobile: "7890544528" },
{ cif: "30022497139", mobile: "6230573848" }, { cif: "30022497139", mobile: "6230573848" },
{ cif: "11122233344", mobile: "9998887776" }, { cif: "11122233344", mobile: "9998887776" },
]; ];

View File

@@ -16,8 +16,8 @@ interface SendOtpPayload {
} }
function getStoredMobileNumber(): string | null { function getStoredMobileNumber(): string | null {
// const mobileNumber = localStorage.getItem('remitter_mobile_no'); const mobileNumber = localStorage.getItem('remitter_mobile_no');
const mobileNumber = "6297421727"; // const mobileNumber = "7890544527";
if (!mobileNumber) { if (!mobileNumber) {
notifications.show({ notifications.show({
title: 'Missing Mobile Number', title: 'Missing Mobile Number',

View File

@@ -13,7 +13,6 @@ import dynamic from 'next/dynamic';
import { generateCaptcha } from '@/app/captcha'; import { generateCaptcha } from '@/app/captcha';
import { IconRefresh, IconShieldLockFilled } from "@tabler/icons-react"; import { IconRefresh, IconShieldLockFilled } from "@tabler/icons-react";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { IconTrash } from "@tabler/icons-react";
import { fetchAndStoreUserName } from "../_util/userdetails"; import { fetchAndStoreUserName } from "../_util/userdetails";
@@ -47,8 +46,8 @@ export default function Login() {
} }
try { try {
console.log(CIF); console.log(CIF);
// await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile }); await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile });
await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: '7890544527' }); // await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: '7890544527' });
notifications.show({ notifications.show({
color: "orange", color: "orange",
title: "OTP Required", title: "OTP Required",
@@ -69,8 +68,8 @@ export default function Login() {
async function handleVerifyOtp(mobile?: string) { async function handleVerifyOtp(mobile?: string) {
try { try {
if (mobile) { if (mobile) {
// await verifyLoginOtp(otp, mobile); await verifyLoginOtp(otp, mobile);
await verifyLoginOtp(otp, '6297421727'); // await verifyLoginOtp(otp, '7890544527');
return true; return true;
} }
} catch { } catch {
@@ -102,7 +101,6 @@ export default function Login() {
}, []); }, []);
const regenerateCaptcha = () => { const regenerateCaptcha = () => {
// setCaptcha(generateCaptcha());
const loadCaptcha = async () => { const loadCaptcha = async () => {
const newCaptcha = await generateCaptcha(); const newCaptcha = await generateCaptcha();
setCaptcha(newCaptcha); setCaptcha(newCaptcha);