Merge branch 'release/2.10.1' into production

This commit is contained in:
Raymond Feng 2015-01-15 13:57:14 -08:00
commit 14da0d8c53
6 changed files with 79 additions and 44 deletions

View File

@ -1,15 +1,13 @@
2015-01-08, Version 2.10.0 2015-01-15, Version 2.10.1
========================== ==========================
* Revert the peer dep change to avoid npm complaints (Raymond Feng) * Optimize the creation of handlers for rest (Raymond Feng)
* Update strong-remoting dep (Raymond Feng) * Add a link to gitter chat (Raymond Feng)
* Allow accessType per remote method (Raymond Feng) * Added context middleware (Rand McKinney)
* API and REST tests added to ensure complete and valid credentials are supplied for verified error message to be returned - tests added as suggested and fail under previous version of User model - strongloop/loopback#931 (Ron Edgecomb) * Use User.remoteMethod instead of loopbacks method This is needed for loopback-connector-remote authorization. Addresses https://github.com/strongloop/loopback/issues/622. (Berkeley Martinez)
* Require valid login credentials before verified email check. - strongloop/loopback#931. (Ron Edgecomb)
2015-01-07, Version 2.9.0 2015-01-07, Version 2.9.0
@ -25,8 +23,25 @@
2015-01-07, Version 2.8.8 2015-01-07, Version 2.8.8
========================= =========================
2015-01-07, Version 2.10.0
==========================
* Revert the peer dep change to avoid npm complaints (Raymond Feng)
* Update strong-remoting dep (Raymond Feng)
* Allow accessType per remote method (Raymond Feng)
* Update juggler dep (Raymond Feng)
* Fix context middleware to preserve domains (Pham Anh Tuan) * Fix context middleware to preserve domains (Pham Anh Tuan)
* Fix Geo test cases (Raymond Feng)
* Allow User.hashPassword/validatePassword to be overridden (Raymond Feng)
* Additional password reset unit tests for API and REST - strongloop/loopback#944 (Ron Edgecomb) * Additional password reset unit tests for API and REST - strongloop/loopback#944 (Ron Edgecomb)
* Small formatting update to have consistency with identical logic in other areas. - strongloop/loopback#944 (Ron Edgecomb) * Small formatting update to have consistency with identical logic in other areas. - strongloop/loopback#944 (Ron Edgecomb)
@ -41,6 +56,10 @@
* Update to demonstrate unit test is actually failing due to incorrect values of invalidCredentials - strongloop/loopback#944 (Ron Edgecomb) * Update to demonstrate unit test is actually failing due to incorrect values of invalidCredentials - strongloop/loopback#944 (Ron Edgecomb)
* API and REST tests added to ensure complete and valid credentials are supplied for verified error message to be returned - tests added as suggested and fail under previous version of User model - strongloop/loopback#931 (Ron Edgecomb)
* Require valid login credentials before verified email check. - strongloop/loopback#931. (Ron Edgecomb)
* fix jscs warning (Clark Wang) * fix jscs warning (Clark Wang)
* fix nestRemoting is nesting hooks from other relations (Clark Wang) * fix nestRemoting is nesting hooks from other relations (Clark Wang)
@ -81,16 +100,19 @@
* Fix bcrypt issues for browserify (Raymond Feng) * Fix bcrypt issues for browserify (Raymond Feng)
2014-12-08, Version 2.8.4
=========================
* Allow native bcrypt for performance (Raymond Feng) * Allow native bcrypt for performance (Raymond Feng)
2014-12-08, Version 2.8.3 2014-12-08, Version 2.8.3
========================= =========================
2014-12-08, Version 2.8.4
=========================
* Allow native bcrypt for performance (Raymond Feng)
* Remove unused underscore dependency (Ryan Graham) * Remove unused underscore dependency (Ryan Graham)
@ -1723,6 +1745,15 @@
* Improve jsdox documentation of app object (Miroslav Bajtoš) * Improve jsdox documentation of app object (Miroslav Bajtoš)
* Make sure methods are called in the context of the calling class (Raymond Feng)
* Start to move md to jsdoc (Ritchie Martori)
2014-01-14, Version 1.5.0
=========================
2014-01-14, Version 1.5.1 2014-01-14, Version 1.5.1
========================= =========================
@ -1733,10 +1764,6 @@
* Start to move md to jsdoc (Ritchie Martori) * Start to move md to jsdoc (Ritchie Martori)
2014-01-14, Version 1.5.0
=========================
* Replace `on` with `once` in middleware examples (Miroslav Bajtoš) * Replace `on` with `once` in middleware examples (Miroslav Bajtoš)
* Fix incorrect transports (Ritchie Martori) * Fix incorrect transports (Ritchie Martori)
@ -1849,21 +1876,20 @@
* Add Model.requireToken, default swagger to false (Ritchie Martori) * Add Model.requireToken, default swagger to false (Ritchie Martori)
* Bump version (Raymond Feng)
* Add password reset (Ritchie Martori) * Add password reset (Ritchie Martori)
2013-12-06, Version show
========================
2013-12-06, Version 1.3.3 2013-12-06, Version 1.3.3
========================= =========================
* Bump version (Raymond Feng) * Bump version (Raymond Feng)
2013-12-06, Version show
========================
* Bump version (Raymond Feng)
* Make loopback-datasource-juggler a peer dep (Raymond Feng) * Make loopback-datasource-juggler a peer dep (Raymond Feng)
* Add blank line before list so it lays out properly. (Rand McKinney) * Add blank line before list so it lays out properly. (Rand McKinney)

View File

@ -82,6 +82,7 @@ The LoopBack community has created and supports a number of additional connector
* [API documentation](http://apidocs.strongloop.com/loopback). * [API documentation](http://apidocs.strongloop.com/loopback).
* [LoopBack Google Group](https://groups.google.com/forum/#!forum/loopbackjs). * [LoopBack Google Group](https://groups.google.com/forum/#!forum/loopbackjs).
* [GitHub issues](https://github.com/strongloop/loopback/issues). * [GitHub issues](https://github.com/strongloop/loopback/issues).
* [Gitter chat](https://gitter.im/strongloop/loopback).
## Contributing ## Contributing

View File

@ -318,7 +318,7 @@ module.exports = function(User) {
options.port + options.port +
options.restApiRoot + options.restApiRoot +
userModel.http.path + userModel.http.path +
userModel.confirm.http.path + userModel.sharedClass.find('confirm', true).http.path +
'?uid=' + '?uid=' +
options.user.id + options.user.id +
'&redirect=' + '&redirect=' +
@ -496,8 +496,8 @@ module.exports = function(User) {
next(); next();
}); });
loopback.remoteMethod( UserModel.remoteMethod(
UserModel.login, 'login',
{ {
description: 'Login a user with username/email and password', description: 'Login a user with username/email and password',
accepts: [ accepts: [
@ -518,8 +518,8 @@ module.exports = function(User) {
} }
); );
loopback.remoteMethod( UserModel.remoteMethod(
UserModel.logout, 'logout',
{ {
description: 'Logout a user with access token', description: 'Logout a user with access token',
accepts: [ accepts: [
@ -537,8 +537,8 @@ module.exports = function(User) {
} }
); );
loopback.remoteMethod( UserModel.remoteMethod(
UserModel.confirm, 'confirm',
{ {
description: 'Confirm a user registration with email verification token', description: 'Confirm a user registration with email verification token',
accepts: [ accepts: [
@ -550,8 +550,8 @@ module.exports = function(User) {
} }
); );
loopback.remoteMethod( UserModel.remoteMethod(
UserModel.resetPassword, 'resetPassword',
{ {
description: 'Reset password for a user with email', description: 'Reset password for a user with email',
accepts: [ accepts: [

View File

@ -10,6 +10,7 @@
"lib/model.js", "lib/model.js",
"lib/persisted-model.js", "lib/persisted-model.js",
{ "title": "Middleware", "depth": 2 }, { "title": "Middleware", "depth": 2 },
"server/middleware/context.js",
"server/middleware/favicon.js", "server/middleware/favicon.js",
"server/middleware/rest.js", "server/middleware/rest.js",
"server/middleware/static.js", "server/middleware/static.js",

View File

@ -1,6 +1,6 @@
{ {
"name": "loopback", "name": "loopback",
"version": "2.10.0", "version": "2.10.1",
"description": "LoopBack: Open Source Framework for Node.js", "description": "LoopBack: Open Source Framework for Node.js",
"homepage": "http://loopback.io", "homepage": "http://loopback.io",
"keywords": [ "keywords": [
@ -102,6 +102,6 @@
"url": "https://github.com/strongloop/loopback/blob/master/LICENSE" "url": "https://github.com/strongloop/loopback/blob/master/LICENSE"
}, },
"optionalDependencies": { "optionalDependencies": {
"sl-blip": "http://blip.strongloop.com/loopback@2.10.0" "sl-blip": "http://blip.strongloop.com/loopback@2.10.1"
} }
} }

View File

@ -23,27 +23,27 @@ module.exports = rest;
*/ */
function rest() { function rest() {
var handlers; // Cached handlers
return function restApiHandler(req, res, next) { return function restApiHandler(req, res, next) {
var app = req.app; var app = req.app;
var restHandler = app.handler('rest');
if (req.url === '/routes') { if (req.url === '/routes') {
return res.send(restHandler.adapter.allRoutes()); return res.send(app.handler('rest').adapter.allRoutes());
} else if (req.url === '/models') { } else if (req.url === '/models') {
return res.send(app.remotes().toJSON()); return res.send(app.remotes().toJSON());
} }
var preHandlers; if (!handlers) {
handlers = [];
if (!preHandlers) {
preHandlers = [];
var remotingOptions = app.get('remoting') || {}; var remotingOptions = app.get('remoting') || {};
var contextOptions = remotingOptions.context; var contextOptions = remotingOptions.context;
if (contextOptions !== false) { if (contextOptions !== false) {
if (typeof contextOptions !== 'object') if (typeof contextOptions !== 'object') {
contextOptions = {}; contextOptions = {};
preHandlers.push(loopback.context(contextOptions)); }
handlers.push(loopback.context(contextOptions));
} }
if (app.isAuthEnabled) { if (app.isAuthEnabled) {
@ -54,11 +54,18 @@ function rest() {
// https://github.com/strongloop/loopback/pull/167 // https://github.com/strongloop/loopback/pull/167
// https://github.com/strongloop/loopback/commit/f07446a // https://github.com/strongloop/loopback/commit/f07446a
var AccessToken = loopback.getModelByType(loopback.AccessToken); var AccessToken = loopback.getModelByType(loopback.AccessToken);
preHandlers.push(loopback.token({ model: AccessToken })); handlers.push(loopback.token({ model: AccessToken }));
} }
}
async.eachSeries(preHandlers.concat(restHandler), function(handler, done) { handlers.push(function(req, res, next) {
// Need to get an instance of the REST handler per request
return app.handler('rest')(req, res, next);
});
}
if (handlers.length === 1) {
return handlers[0](req, res, next);
}
async.eachSeries(handlers, function(handler, done) {
handler(req, res, done); handler(req, res, done);
}, next); }, next);
}; };