feat : Implement last las login feature

feat : add transaction password column and write logic for transaction password.
This commit is contained in:
2025-07-22 12:49:44 +05:30
parent 32f6430a5c
commit d4d741b8cc
10 changed files with 141 additions and 9 deletions

View File

@@ -0,0 +1,16 @@
const authService = require('../services/auth.service');
const tpasswordValidator = async (req, res, next) => {
const customerNo = req.user;
const { tpassword } = req.body;
if (!tpassword) {
return res.status(400).json({ error: 'BAD_REQUEST' });
}
const valid = await authService.validateTransactionPassword(customerNo, tpassword);
if (valid === null) res.status(400).json({ error: 'TransactionPassword_NOT_SET_FOR_USER' });
if (!valid) return res.status(401).json({ error: 'INCORRECT_TransactionPassword' });
next();
};
module.exports = tpasswordValidator;

View File

@@ -1,7 +1,7 @@
const transferValidator = async (req, res, next) => {
const { fromAccount, toAccount, toAccountType, amount } = req.body;
const accountTypes = ['SB', 'LN'];
const accountTypes = ['SB', 'LN','Savings','Current'];
if (!fromAccount || fromAccount.length != 11) {
return res.status(400).json({ error: 'INVALID_ACCOUNT_NUMBER_FORMAT' });
}