Merge branch 'release/1.9.1' into production

This commit is contained in:
Miroslav Bajtoš 2014-06-27 10:26:15 +02:00
commit 7e670c85c9
4 changed files with 7 additions and 11 deletions

View File

@ -51,14 +51,8 @@ function token(options) {
return function (req, res, next) { return function (req, res, next) {
if (req.accessToken !== undefined) return next(); if (req.accessToken !== undefined) return next();
TokenModel.findForRequest(req, options, function(err, token) { TokenModel.findForRequest(req, options, function(err, token) {
if(err) return next(err); req.accessToken = token || null;
if(token) { next(err);
req.accessToken = token;
next();
} else {
req.accessToken = null;
return next();
}
}); });
} }
} }

View File

@ -133,7 +133,9 @@ AccessToken.findForRequest = function(req, options, cb) {
} else if(isValid) { } else if(isValid) {
cb(null, token); cb(null, token);
} else { } else {
cb(new Error('Invalid Access Token')); var e = new Error('Invalid Access Token');
e.status = e.statusCode = 401;
cb(e);
} }
}); });
} else { } else {

View File

@ -248,7 +248,7 @@ registry.memory = function (name) {
if(!memory) { if(!memory) {
memory = this._memoryDataSources[name] = this.createDataSource({ memory = this._memoryDataSources[name] = this.createDataSource({
connector: loopback.Memory connector: 'memory'
}); });
} }

View File

@ -26,7 +26,7 @@
"mobile", "mobile",
"mBaaS" "mBaaS"
], ],
"version": "1.9.0", "version": "1.9.1",
"scripts": { "scripts": {
"test": "mocha -R spec" "test": "mocha -R spec"
}, },