From e5b94527a97a2fd8bf5da036b291ae0c3bab4140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Mon, 7 Apr 2014 08:25:53 +0700 Subject: [PATCH] Attach `device` object from `isAuthorized` to request --- lib/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/app.js b/lib/app.js index c367bd7a..36dbdecb 100755 --- a/lib/app.js +++ b/lib/app.js @@ -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(); }); };