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) {
if (req.accessToken !== undefined) return next();
TokenModel.findForRequest(req, options, function(err, token) {
if(err) return next(err);
if(token) {
req.accessToken = token;
next();
} else {
req.accessToken = null;
return next();
}
req.accessToken = token || null;
next(err);
});
}
}

View File

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

View File

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

View File

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