Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyendacthienngan committed Dec 29, 2021
1 parent 173e193 commit 7ee2003
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/users.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports.login = async function (request, response) {
const checkPassword = await bcrypt.compare(request.body.password, account.password);
if (!checkPassword) return response.status(422).send('Password is not correct');
try {
let user = await User.findOne({user_id: account._id});
let user = await User.findOne({_id: account.user_id});
if (user) {
const token = jwt.sign({_id: user._id}, process.env.TOKEN_SECRET, { expiresIn: 60 * 60 * 24 }); //outdated in 1 day
const result = {
Expand Down

0 comments on commit 7ee2003

Please sign in to comment.