Minor bugfixes

This commit is contained in:
2021-01-27 01:52:18 +11:00
parent 8c754b4570
commit 6468b02647
4 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -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;
+5 -1
View File
@@ -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