spiele editierbar
This commit is contained in:
parent
e8c9d2574f
commit
173a95d721
14
app.js
14
app.js
|
@ -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 => {
|
||||
|
|
Loading…
Reference in New Issue