feat : Transaction Password Setup Status
This commit is contained in:
@@ -168,6 +168,23 @@ async function tpin(req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function transPassword(req, res) {
|
||||||
|
const customerNo = req.user;
|
||||||
|
try {
|
||||||
|
const user = await authService.findUserByCustomerNo(customerNo);
|
||||||
|
if (!user) return res.status(404).json({ message: 'USER_NOT_FOUND' });
|
||||||
|
if (!user.transaction_password) {
|
||||||
|
return res.json({ transPasswordSet: false });
|
||||||
|
} else {
|
||||||
|
return res.json({ transPasswordSet: true });
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, 'error occured while checking transaction password');
|
||||||
|
res.status(500).json({ error: 'something went wrong' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function setTpin(req, res) {
|
async function setTpin(req, res) {
|
||||||
const customerNo = req.user;
|
const customerNo = req.user;
|
||||||
try {
|
try {
|
||||||
@@ -221,13 +238,13 @@ async function setLoginPassword(req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setTransactionPassword(req, res) {
|
async function setTransPassword(req, res) {
|
||||||
const customerNo = req.user;
|
const customerNo = req.user;
|
||||||
try {
|
try {
|
||||||
const user = await authService.findUserByCustomerNo(customerNo);
|
const user = await authService.findUserByCustomerNo(customerNo);
|
||||||
if (!user) return res.status(404).json({ error: 'USER_NOT_FOUND' });
|
if (!user) return res.status(404).json({ error: 'USER_NOT_FOUND' });
|
||||||
const { transaction_password } = req.body;
|
const { transaction_password } = req.body;
|
||||||
authService.setTransactionPassword(customerNo, transaction_password);
|
authService.setTransPassword(customerNo, transaction_password);
|
||||||
return res.json({ message: 'Transaction Password set' });
|
return res.json({ message: 'Transaction Password set' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
@@ -395,7 +412,8 @@ module.exports = {
|
|||||||
setTpin,
|
setTpin,
|
||||||
changeTpin,
|
changeTpin,
|
||||||
setLoginPassword,
|
setLoginPassword,
|
||||||
setTransactionPassword,
|
transPassword,
|
||||||
|
setTransPassword,
|
||||||
fetchUserDetails,
|
fetchUserDetails,
|
||||||
changeLoginPassword,
|
changeLoginPassword,
|
||||||
changeTransPassword,
|
changeTransPassword,
|
||||||
|
|||||||
@@ -6,20 +6,24 @@ const router = express.Router();
|
|||||||
|
|
||||||
router.post('/login', authController.login);
|
router.post('/login', authController.login);
|
||||||
router.get('/user_details', authenticate, authController.fetchUserDetails);
|
router.get('/user_details', authenticate, authController.fetchUserDetails);
|
||||||
|
|
||||||
router.get('/tpin', authenticate, authController.tpin);
|
router.get('/tpin', authenticate, authController.tpin);
|
||||||
router.post('/tpin', authenticate, authController.setTpin);
|
router.post('/tpin', authenticate, authController.setTpin);
|
||||||
router.post('/change/tpin', authenticate, authController.changeTpin);
|
router.post('/change/tpin', authenticate, authController.changeTpin);
|
||||||
|
|
||||||
router.post('/login_password', authenticate, authController.setLoginPassword);
|
router.post('/login_password', authenticate, authController.setLoginPassword);
|
||||||
router.post(
|
|
||||||
'/transaction_password',
|
|
||||||
authenticate,
|
|
||||||
authController.setTransactionPassword
|
|
||||||
);
|
|
||||||
router.post(
|
router.post(
|
||||||
'/change/login_password',
|
'/change/login_password',
|
||||||
authenticate,
|
authenticate,
|
||||||
authController.changeLoginPassword
|
authController.changeLoginPassword
|
||||||
);
|
);
|
||||||
|
|
||||||
|
router.get('/transaction_password', authenticate, authController.transPassword);
|
||||||
|
router.post(
|
||||||
|
'/transaction_password',
|
||||||
|
authenticate,
|
||||||
|
authController.setTransPassword
|
||||||
|
);
|
||||||
router.post(
|
router.post(
|
||||||
'/change/transaction_password',
|
'/change/transaction_password',
|
||||||
authenticate,
|
authenticate,
|
||||||
|
|||||||
Reference in New Issue
Block a user