Use correct args
This commit is contained in:
parent
8a9bfd4c43
commit
e98a4f45fc
|
@ -30,11 +30,11 @@ router.post('/', (req, res) => {
|
||||||
// This is the original code, commented out for debugging
|
// This is the original code, commented out for debugging
|
||||||
if (!user) return res.status(401).render('login', { error: 'Invalid username or password.' });
|
if (!user) return res.status(401).render('login', { error: 'Invalid username or password.' });
|
||||||
console.log(password, user.passwordHash);
|
console.log(password, user.passwordHash);
|
||||||
const match = await global.comparePassword(user);
|
const match = await global.comparePassword(password, user.passwordHash);
|
||||||
console.log(match)
|
console.log(match)
|
||||||
// if (!match) return res.status(401).render('login', { error: 'Invalid username or password.' });
|
if (!match) return res.status(401).render('login', { error: 'Invalid username or password.' });
|
||||||
// req.session.user = { user };
|
req.session.user = { user };
|
||||||
// res.redirect('/dashboard');
|
res.redirect('/dashboard');
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
global.log.error(`Database error during login: ${err}`);
|
global.log.error(`Database error during login: ${err}`);
|
||||||
res.status(500).render('login', { error: 'Internal server error.' });
|
res.status(500).render('login', { error: 'Internal server error.' });
|
||||||
|
|
Loading…
Reference in a new issue