Semaphore/lib/util.js

17 lines
256 B
JavaScript
Raw Normal View History

2014-08-24 19:36:34 +02:00
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"
})
}
})
}
}