Update 'src/api/middlewares/authen.middleware.js'

master
tungd0 2 years ago
parent 8d0ff2ea54
commit d9a228ce88
  1. 4
      src/api/middlewares/authen.middleware.js

@ -35,7 +35,7 @@ exports.loadUser = async (req, res, next) => {
try {
const user = await User.getUserByPhoneOrEmail({ email: req.body.email || req.body.username });
if (!user) {
return res.status(400).json({ message: 'email incorrect' });
return res.status(400).json({ message: 'email or password is incorrect' });
}
req.locals = {
user
@ -51,7 +51,7 @@ exports.checkPassword = async (req, res, next) => {
// console.log(user);
const isCheck = await User.passwordMatches(user, req.body.password);
if (!isCheck) {
return res.status(400).json({ message: ' password incorrect' });
return res.status(400).json({ message: 'email or password is incorrect' });
}
return next();
};

Loading…
Cancel
Save