Merge branch 'release/1.9.1' into production
This commit is contained in:
commit
7e670c85c9
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -248,7 +248,7 @@ registry.memory = function (name) {
|
|||
|
||||
if(!memory) {
|
||||
memory = this._memoryDataSources[name] = this.createDataSource({
|
||||
connector: loopback.Memory
|
||||
connector: 'memory'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"mobile",
|
||||
"mBaaS"
|
||||
],
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue