Minor bugfixes
This commit is contained in:
@@ -5,6 +5,6 @@ const router = express.Router();
|
||||
router.post('/signup', require('./signup'));
|
||||
router.get('/validation', require('./validation'));
|
||||
router.post('/login', require('./login'));
|
||||
router.get('/logout', require('./logout'));
|
||||
router.post('/logout', require('./logout'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -24,12 +24,16 @@ const route = async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
if (!account) {
|
||||
return res.status(401).send('incorrect email or password');
|
||||
}
|
||||
|
||||
//compare passwords
|
||||
const compare = utils.promisify(bcrypt.compare);
|
||||
const match = await compare(req.fields.password, account.hash);
|
||||
|
||||
if (!match) {
|
||||
return res.status(401).send('passwords don\'t match');
|
||||
return res.status(401).send('incorrect email or password');
|
||||
}
|
||||
|
||||
//save the session and cookie data
|
||||
|
||||
Reference in New Issue
Block a user