Semaphore/lib/util.js
2014-08-24 18:36:34 +01:00

17 lines
256 B
JavaScript

exports.authorized = function (req, res, next) {
if (res.locals.loggedIn) {
next()
} else {
res.format({
html: function() {
res.render('auth');
},
json: function() {
res.send(403, {
message: "Unauthorized"
})
}
})
}
}