diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 23060f7a0f..6ade29e383 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -227,13 +227,22 @@ categoriesController.get = function(req, res, next) { }; categoriesController.notFound = function(req, res) { - res.locals.isAPI ? res.status(404).json('not-found') : res.status(404).render('404'); + if (res.locals.isAPI) { + res.status(404).json('not-found'); + } else { + res.status(404).render('404'); + } }; categoriesController.notAllowed = function(req, res) { var uid = req.user ? req.user.uid : 0; + if (uid) { - res.locals.isAPI ? res.status(403).json('not-allowed') : res.status(403).render('403'); + if (res.locals.isAPI) { + res.status(403).json('not-allowed'); + } else { + res.status(403).render('403'); + } } else { if (res.locals.isAPI) { req.session.returnTo = apiToRegular(req.url);