mirror of https://github.com/status-im/codimd.git
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
|
@ -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 New Issue