This commit is contained in:
Martin Gontovnikas 2014-07-25 15:05:22 -07:00
Родитель dfa96dfd8b
Коммит 1603579c5c
2 изменённых файлов: 4 добавлений и 2 удалений

2
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;

Просмотреть файл

@ -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) {