-
Notifications
You must be signed in to change notification settings - Fork 71
add /profile/updatePassword #3
Copy link
Copy link
Open
Description
profileAuth.patch("/profile/updatePassword",userAuth,async(req,res)=>{
try{
const {password}=req.body;
const loggedInUser=req.user;
const isSame= await bcrypt.compare(password,loggedInUser.password,);
if(isSame){
throw new Error("Previous password and Updated password are same. Try diffferent !! ")
}
loggedInUser.password=password;
await loggedInUser.save();
res.send("Password updated Successfully");
}
catch(err){
res.status(400).send("Error : "+err.message);
}
})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels