diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index b3a4738e45..c54ebc52c5 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -264,7 +264,9 @@ function continueLogin(req, res, next) { await authenticationController.doLogin(req, userData.uid); var destination; if (req.session.returnTo) { - destination = req.session.returnTo; + destination = req.session.returnTo.startsWith('http') ? + req.session.returnTo : + nconf.get('relative_path') + req.session.returnTo; delete req.session.returnTo; } else { destination = nconf.get('relative_path') + '/';