1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 18:39:32 +00:00

Added redirect_to to login page when auth forces re-authentication

This commit is contained in:
2022-04-12 00:34:32 +00:00
parent 26f0a6e2cc
commit 6406cd5a5c
3 changed files with 9 additions and 2 deletions

View File

@@ -21,7 +21,8 @@ router.get('/login', (req, res) => {
return res.redirect('/admin');
return res.render('login', {
title: 'Stratos - Login'
title: 'Stratos - Login',
redirect_to: req.query?.redirect_to
});
});
@@ -79,6 +80,10 @@ router.post('/login', async (req, res) => {
if (await u.verifyPassword(fields.get('password'))) {
u.login(req);
if (fields.get('redirectTo').length > 0)
return res.redirect(fields.get('redirectTo'));
return res.redirect('/admin');
}