spiele editierbar

This commit is contained in:
Klaas 2024-05-28 15:48:28 +02:00
parent e8c9d2574f
commit 173a95d721
1 changed files with 11 additions and 3 deletions

14
app.js
View File

@ -229,9 +229,13 @@ app.post('/login', async (req, res) => {
const user = userResult.rows[0];
const match = await bcrypt.compare(password, user.password);
if (match) {
req.session.userId = user.id;
req.session.role=user.role;
res.redirect('/');
if (user.is_active) {
req.session.userId = user.id;
req.session.role=user.role;
res.redirect('/');
} else {
res.redirect('/freischaltung')
}
} else {
res.redirect('/login');
}
@ -244,6 +248,10 @@ app.post('/login', async (req, res) => {
}
});
app.get('/freischaltung', async (req, res) => {
res.render('freischaltung', { session: req.session});
})
// Logout
app.get('/logout', (req, res) => {
req.session.destroy(err => {