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 user = userResult.rows[0];
const match = await bcrypt.compare(password, user.password); const match = await bcrypt.compare(password, user.password);
if (match) { if (match) {
req.session.userId = user.id; if (user.is_active) {
req.session.role=user.role; req.session.userId = user.id;
res.redirect('/'); req.session.role=user.role;
res.redirect('/');
} else {
res.redirect('/freischaltung')
}
} else { } else {
res.redirect('/login'); 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 // Logout
app.get('/logout', (req, res) => { app.get('/logout', (req, res) => {
req.session.destroy(err => { req.session.destroy(err => {