Attach device object from isAuthorized to request

This commit is contained in:
Maciej Małecki 2014-04-07 08:25:53 +07:00
parent d80758e834
commit e5b94527a9

View file

@ -55,9 +55,10 @@ config.load(function(err, conf) {
var e = new Error('Unauthorized');
e.status = 401;
config.isAuthorized(fingerprint, function (err, authorized) {
config.isAuthorized(fingerprint, function (err, device) {
if (err) { return next(e); }
if (!authorized) { return next(e); }
if (!device) { return next(e); }
req.device = device;
next();
});
};