2020-01-04 21:59:57 +00:00
|
|
|
'use strict'
|
|
|
|
|
2020-01-04 22:30:23 +00:00
|
|
|
const config = require('../config')
|
|
|
|
const { responseError } = require('../response')
|
2020-01-04 21:59:57 +00:00
|
|
|
|
|
|
|
exports.errorForbidden = (req, res) => {
|
|
|
|
if (req.user) {
|
|
|
|
return responseError(res, '403', 'Forbidden', 'oh no.')
|
|
|
|
}
|
|
|
|
|
|
|
|
req.flash('error', 'You are not allowed to access this page. Maybe try logging in?')
|
|
|
|
res.redirect(config.serverURL + '/')
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.errorNotFound = (req, res) => {
|
|
|
|
responseError(res, '404', 'Not Found', 'oops.')
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.errorInternalError = (req, res) => {
|
|
|
|
responseError(res, '500', 'Internal Error', 'wtf.')
|
|
|
|
}
|