Do some more ACL stuff

This commit is contained in:
Christopher Cookman 2025-08-31 11:21:14 -06:00
parent 5d6d5eb20d
commit d6f1c8fea8
2 changed files with 5 additions and 2 deletions

View file

@ -27,13 +27,13 @@ router.post('/', (req, res) => {
user = user[0]; user = user[0];
console.log(user); console.log(user);
//res.send("Test") //res.send("Test")
// This is the original code, commented out for debugging // This is the original code, commented out for debuggingw
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(password, user.passwordHash); 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}`);

View file

@ -45,6 +45,9 @@
<body> <body>
<div class="dashboard-container"> <div class="dashboard-container">
<div class="dashboard-title">Dashboard</div> <div class="dashboard-title">Dashboard</div>
<div style="margin-bottom: 16px; color: #555;">
Logged in as <strong><%= sessionData.user.username %></strong>
</div>
<div class="dashboard-buttons"> <div class="dashboard-buttons">
<form action="/event-logs" method="get"> <form action="/event-logs" method="get">
<button type="submit">Event Logs</button> <button type="submit">Event Logs</button>