feat : Implement last las login feature
feat : add transaction password column and write logic for transaction password.
This commit is contained in:
16
src/validators/tpassword.validator.js
Normal file
16
src/validators/tpassword.validator.js
Normal 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;
|
||||
@@ -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' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user