spiele editierbar
This commit is contained in:
parent
e8c9d2574f
commit
173a95d721
8
app.js
8
app.js
|
@ -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) {
|
||||||
|
if (user.is_active) {
|
||||||
req.session.userId = user.id;
|
req.session.userId = user.id;
|
||||||
req.session.role=user.role;
|
req.session.role=user.role;
|
||||||
res.redirect('/');
|
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 => {
|
||||||
|
|
Loading…
Reference in New Issue