|
|
|
@ -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(); |
|
|
|
|
}; |
|
|
|
|