This commit is contained in:
barisusakli
2014-12-01 21:07:23 -05:00
parent be11577aa4
commit ddd6ed9e8c
7 changed files with 19 additions and 25 deletions

View File

@@ -12,14 +12,14 @@ helpers.notFound = function(req, res, error) {
}
};
helpers.notAllowed = function(req, res) {
helpers.notAllowed = function(req, res, error) {
var uid = req.user ? req.user.uid : 0;
if (uid) {
if (res.locals.isAPI) {
res.status(403).json('not-allowed');
res.status(403).json({path: req.path.replace(/^\/api/, ''), loggedIn: !!uid, error: error});
} else {
res.status(403).render('403');
res.status(403).render('403', {path: req.path, loggedIn: !!uid, error: error});
}
} else {
if (res.locals.isAPI) {