Skip to content

Commit

Permalink
update auth
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgonzaDJun committed Dec 2, 2023
1 parent 72e16f9 commit ef6ba04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions controllers/auth.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const bcrypt = require("bcrypt")
const bcrypt = require("bcrypt");
const User = require("../models/user");
const jwt = require("jsonwebtoken");
const OTP = require("../models/otp");
Expand All @@ -24,7 +24,7 @@ const login = async (req, res) => {
}

//compare password user with hashpassword
const isPasswordValid = bcrypt.compare(password, user.password);
const isPasswordValid = await bcrypt.compare(password, user.password);

if (!isPasswordValid) {
return res.status(404).json({
Expand All @@ -37,6 +37,8 @@ const login = async (req, res) => {
res.setHeader("authorization", `Bearer ${token}`);

res.status(200).json({
status: "OK",
message: "User Autenticate Successfully",
userId: user._id,
token,
});
Expand Down

0 comments on commit ef6ba04

Please sign in to comment.