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:
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user