add redirect from login

This commit is contained in:
b1ek 2023-02-27 17:24:49 +10:00
parent bd35ae416b
commit 4ff8a25c06
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 14 additions and 2 deletions

View File

@ -22,13 +22,25 @@ async function apiLogin(req, res) {
}
const session = await user.createSession();
req.session.user = session;
res.send(req.session);
//res.redirect('/admin/panel');
res.redirect('/admin/panel');
return;
}
async function panel(req, res) {
res.send(await Helpers.ViewLoader.load('admin/panel.pug', {
current_route: req.originalUrl
}));
return;
}
module.exports = (router) => {
// login
router.get('/login', handler(login));
router.get('/admin/login', handler(login));
router.post('/admin/login', handler(apiLogin));
// panel
router.get('/admin/panel', handler(panel));
}