Debugging login
This commit is contained in:
parent
caee2ede70
commit
3bea149517
|
@ -20,6 +20,7 @@ router.get('/', (req, res) => {
|
||||||
router.post('/', (req, res) => {
|
router.post('/', (req, res) => {
|
||||||
if (req.session.user) return res.redirect('/dashboard');
|
if (req.session.user) return res.redirect('/dashboard');
|
||||||
const { username, password } = req.body;
|
const { username, password } = req.body;
|
||||||
|
console.log(req.body)
|
||||||
if (!username || !password) return res.status(400).render('login', { error: 'Username and password are required.' });
|
if (!username || !password) return res.status(400).render('login', { error: 'Username and password are required.' });
|
||||||
db.query('SELECT * FROM users WHERE username = ?', [username]).then(async (user) => {
|
db.query('SELECT * FROM users WHERE username = ?', [username]).then(async (user) => {
|
||||||
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.' });
|
||||||
|
|
Loading…
Reference in a new issue