Fixed packager
This commit is contained in:
Родитель
dfa96dfd8b
Коммит
1603579c5c
2
app.js
2
app.js
|
@ -196,6 +196,8 @@ var overrideIfAuthenticated = function (req, res, next) {
|
||||||
|
|
||||||
winston.debug('client found');
|
winston.debug('client found');
|
||||||
|
|
||||||
|
res.locals.account = res.locals.account || {};
|
||||||
|
|
||||||
res.locals.account.loggedIn = true;
|
res.locals.account.loggedIn = true;
|
||||||
|
|
||||||
res.locals.account.clients = nonGlobalClients;
|
res.locals.account.clients = nonGlobalClients;
|
||||||
|
|
|
@ -7,12 +7,12 @@ module.exports = function (app, authenticatedVarsMiddleware) {
|
||||||
if (nconf.get('PACKAGER_URL')) {
|
if (nconf.get('PACKAGER_URL')) {
|
||||||
app.get('/:repo/:branch/create-package', authenticatedVarsMiddleware, function(req, res) {
|
app.get('/:repo/:branch/create-package', authenticatedVarsMiddleware, function(req, res) {
|
||||||
if (req.query.clientId) {
|
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');
|
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) {
|
var localClient = _.find(res.locals.account.clients, function(client) {
|
||||||
return client.cliendID === req.query.clientId;
|
return client.clientID === req.query.clientId;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!localClient) {
|
if (!localClient) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче