mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Merge pull request #785 from pferreir/redirect-to-login
403: Redirect user to login page if not logged in
This commit is contained in:
commit
12ab90020a
1 changed files with 7 additions and 1 deletions
|
@ -17,7 +17,13 @@ var utils = require('./utils')
|
|||
// public
|
||||
var response = {
|
||||
errorForbidden: function (res) {
|
||||
responseError(res, '403', 'Forbidden', 'oh no.')
|
||||
const {req} = res
|
||||
if (req.user) {
|
||||
responseError(res, '403', 'Forbidden', 'oh no.')
|
||||
} else {
|
||||
req.flash('error', 'You are not allowed to access this page. Maybe try logging in?')
|
||||
res.redirect(config.serverURL)
|
||||
}
|
||||
},
|
||||
errorNotFound: function (res) {
|
||||
responseError(res, '404', 'Not Found', 'oops.')
|
||||
|
|
Loading…
Reference in a new issue