feat: Change login Password
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user