From 4857ef6cab58c93f48c8c940f29de6ad7729841f Mon Sep 17 00:00:00 2001 From: "tomosa.sarkar" Date: Tue, 2 Sep 2025 16:05:11 +0530 Subject: [PATCH] feat: Change login Password --- src/controllers/auth.controller.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controllers/auth.controller.js b/src/controllers/auth.controller.js index 061e159..cbd9b9b 100644 --- a/src/controllers/auth.controller.js +++ b/src/controllers/auth.controller.js @@ -117,12 +117,12 @@ async function changeLoginPassword(req,res){ const { OldLPsw ,newLPsw ,confirmLPsw } = req.body; const isMatch = await comparePassword(OldLPsw, user.password_hash); if(!isMatch) - return res.json({error: 'Please Enter Correct Old Login Password'}); + return res.status(500).json({error: 'Please Enter Correct Old Login Password'}); if(newLPsw !== confirmLPsw) - return res.json ({error: 'New Password and Confirm Password not Match'}) + return res.status(500).json ({error: 'New Password and Confirm Password not Match'}) const isMatchWithOldPassword = await comparePassword(newLPsw, user.password_hash); if(isMatchWithOldPassword) - return res.json ({error: 'New Password will be different from Previous Password'}) + return res.status(500).json ({error: 'New Password will be different from Previous Password'}) authService.changeLoginPassword(customerNo, newLPsw); return res.json({ message: 'New Login Password changed successfully' }); } catch (error) { @@ -139,12 +139,12 @@ async function changeTransPassword(req,res){ const { OldTPsw ,newTPsw ,confirmTPsw } = req.body; const isMatch = await comparePassword(OldTPsw, user.transaction_password); if(!isMatch) - return res.json({error: 'Please Enter Correct Old Transaction Password'}); + return res.status(500).json({error: 'Please Enter Correct Old Transaction Password'}); if(newTPsw !== confirmTPsw) - return res.json ({error: 'New Transaction Password and Confirm Transaction Password not Match'}) + return res.status(500).json ({error: 'New Transaction Password and Confirm Transaction Password not Match'}) const isMatchWithOldPassword = await comparePassword(newTPsw, user.transaction_password); if(isMatchWithOldPassword) - return res.json ({error: 'New Transaction Password will be different from Previous Transaction Password'}) + return res.status(500).json ({error: 'New Transaction Password will be different from Previous Transaction Password'}) authService.changeTransPassword(customerNo, newTPsw); return res.json({ message: 'New Transaction Password changed successfully' }); } catch (error) {