From 1603579c5c2e38e465f6674d36f490588ef05eba Mon Sep 17 00:00:00 2001 From: Martin Gontovnikas Date: Fri, 25 Jul 2014 15:05:22 -0700 Subject: [PATCH] Fixed packager --- app.js | 2 ++ lib/packager/index.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index ab6bcf3..d89dd4a 100644 --- a/app.js +++ b/app.js @@ -196,6 +196,8 @@ var overrideIfAuthenticated = function (req, res, next) { winston.debug('client found'); + res.locals.account = res.locals.account || {}; + res.locals.account.loggedIn = true; res.locals.account.clients = nonGlobalClients; diff --git a/lib/packager/index.js b/lib/packager/index.js index 52c26eb..21e071a 100644 --- a/lib/packager/index.js +++ b/lib/packager/index.js @@ -7,12 +7,12 @@ module.exports = function (app, authenticatedVarsMiddleware) { if (nconf.get('PACKAGER_URL')) { app.get('/:repo/:branch/create-package', authenticatedVarsMiddleware, function(req, res) { if (req.query.clientId) { - if (!res.locals.accounts) { + if (!res.locals.account) { return res.send(401, 'Unauthorized: You need to log in to be able to use a clientId'); } var localClient = _.find(res.locals.account.clients, function(client) { - return client.cliendID === req.query.clientId; + return client.clientID === req.query.clientId; }); if (!localClient) {