diff options
author | Christoph (Sheogorath) Kern | 2018-05-31 12:16:11 +0200 |
---|---|---|
committer | GitHub | 2018-05-31 12:16:11 +0200 |
commit | 12ab90020abc8a91f9eb9348ce2748ffa1d29365 (patch) | |
tree | b378b24270b694629cefc7fa4910f4f27018f7fa | |
parent | a258719d342b64b9496bbeab6de5571721eb74d1 (diff) | |
parent | 99abac343bd098ea032cac8e5b703193ad41d069 (diff) |
Merge pull request #785 from pferreir/redirect-to-login
403: Redirect user to login page if not logged in
Diffstat (limited to '')
-rw-r--r-- | lib/response.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/response.js b/lib/response.js index ae3e45fa..d6fb3b42 100644 --- a/lib/response.js +++ b/lib/response.js @@ -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.') |