feat: add message template for e-mandate

This commit is contained in:
2025-09-25 12:07:02 +05:30
parent ffbbea27d7
commit edbeca3fd2
3 changed files with 10 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ const { comparePassword } = require('../util/hash');
async function login(req, res) {
const { customerNo, password } = req.body;
const loginType = req.headers['x-login-type'] || 'standard';
if (!customerNo || !password) {
return res
@@ -39,9 +40,10 @@ async function login(req, res) {
currentTime,
customerNo,
]);
logger.info(`Login successful | Type: ${loginType}`);
res.json({ token, FirstTimeLogin, loginPswExpiry, rights });
} catch (err) {
logger.error(err, 'login failed');
logger.error(err, `login failed | Type: ${loginType}`);
res.status(500).json({ error: 'something went wrong' });
}
}

View File

@@ -82,6 +82,10 @@ async function SendOtp(req, res) {
case 'RIGHT_UPDATE':
message = templates.RIGHT_UPDATE;
break;
case 'EMandate':
otp = generateOTP(6);
message = templates.EMandate(otp);
break;
default:
return res.status(400).json({ error: 'Invalid OTP type' });
}