mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-28 22:54:29 -05:00
Fix broken redirect on login
This patch fixes the currently broken redirect on login when people try to access a site they have no access to, they are redirected to the main page to log in. After a successful login they should be redirected to the original note, but instead are redirect to the index page again. This aptch fixes the typo that causes the behavior and brings people back to the note they edited. Thanks to @clvs7-gh on Github[1], who submitted the patch via email. On their behalf I hereby submit the change. [1]: https://github.com/clvs7-gh Note: I had to ajust this patch to work properly. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
840109b129
commit
d389f45818
1 changed files with 4 additions and 2 deletions
|
@ -7,8 +7,10 @@ module.exports = {
|
|||
responseError(res, '403', 'Forbidden', 'oh no.')
|
||||
} else {
|
||||
if (!req.session) req.session = {}
|
||||
req.session.returnTo = req.originalUrl || config.serverUrl + '/'
|
||||
req.flash('error', 'You are not allowed to access this page. Maybe try logging in?')
|
||||
if (req.originalUrl !== '/403') {
|
||||
req.session.returnTo = config.serverURL + (req.originalUrl || '/')
|
||||
req.flash('error', 'You are not allowed to access this page. Maybe try logging in?')
|
||||
}
|
||||
res.redirect(config.serverURL + '/')
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue