Debugging login

This commit is contained in:
Christopher Cookman 2025-08-31 11:10:21 -06:00
parent caee2ede70
commit 3bea149517

View file

@ -20,6 +20,7 @@ router.get('/', (req, res) => {
router.post('/', (req, res) => {
if (req.session.user) return res.redirect('/dashboard');
const { username, password } = req.body;
console.log(req.body)
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) => {
if (!user) return res.status(401).render('login', { error: 'Invalid username or password.' });