Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-Thakur committed Jun 3, 2021
1 parent fe14fdf commit 59c8c99
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ function fetchUser(req, res) {
console.log(req.body);
user.findOne( { email: req.body.email}, function(err, docs) {
if(!err){
const cmp = await bcrypt.compare(req.body.password, docs.password);
if(cmp) {
res.json(docs);
} else {
console.log('Wrong Password: ' + err);
res.json({
errorMessage = "Wrong Password. Try again."
});
}
bcrypt.comparePassword(req.body.password, docs.password, (err, cmp) => {
if(cmp) {
res.json(docs);
} else {
console.log('Wrong Password: ' + err);
res.json({
errorMessage = "Wrong Password. Try again."
});
}
})
} else {
console.log('Error in retrieving user: ' + err);
res.json({
Expand Down

1 comment on commit 59c8c99

@vercel
Copy link

@vercel vercel bot commented on 59c8c99 Jun 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.