|
|
@ -149,16 +149,6 @@ module.exports.resetPassword = async (req, res) => {
|
|
|
|
// Get the new password from the request body
|
|
|
|
// Get the new password from the request body
|
|
|
|
const { newPassword } = req.body;
|
|
|
|
const { newPassword } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
User.findOne({email : req.user.email}).then(result =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isPasswordEqualtoOld = bcrypt.compareSync(newPassword, result.password);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isPasswordEqualtoOld){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response.send({message: "New password should not be same with old password"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Hash the new password
|
|
|
|
// Hash the new password
|
|
|
|
const hashedPassword = await bcrypt.hash(newPassword, 10);
|
|
|
|
const hashedPassword = await bcrypt.hash(newPassword, 10);
|
|
|
|
|
|
|
|
|
|
|
|