Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
fix some whitespace and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyej committed Feb 26, 2016
1 parent 7f13cd6 commit 698d43f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/upgrading.rst
Expand Up @@ -29,19 +29,19 @@ before release:
- ``web.register.fieldOrder`` -> ``web.register.form.fieldOrder``

- ``web.expand[property]`` options won't affect the ``/me`` route anymore. To
enable expansions on the `/me` route, use ``web.me.expand[property]``
enable expansions on the ``/me`` route, use ``web.me.expand[property]``.

- The JSON response for the register route is now wrapping the account data in
``{ account: { /* account data */ } }``. Previously it was not wrapped inside
this account property. Linked resources have also been stripped from the
response, for security purposes.

- We've stopped resolving the user by default, for un-authenticated routes. If
- We've stopped resolving the user by default for unauthenticated routes. If
you have a route that does not require authentication, but you want to know
the context of the current user (if they're logged in), then add the
``stormpath.getUser`` middleware to the route.

- You no longer need to wait for ``stormpath.ready`` to start your serer. If
- You no longer need to wait for ``stormpath.ready`` to start your server. If
the server is waiting on Stormpath to initialize, it will hold the request
until Stormpath is ready.

Expand Down
4 changes: 2 additions & 2 deletions lib/controllers/current-user.js
Expand Up @@ -5,7 +5,8 @@ var _ = require('lodash');
var expandAccount = require('../helpers').expandAccount;
/**
* Send the current user as a JSON response. The developer can opt-in to
* expanded properties via stormpath.web.me.expand.[resource]
* expanded properties via stormpath.web.me.expand.[resource].
*
* @param {Object} req - The http request.
* @param {Object} res - The http response.
*/
Expand All @@ -19,7 +20,6 @@ function currentUser(req, res) {
});

// All other properties, that have not been expanded, should be removed.

var strippedAccount = _.clone(expandedAccount);

Object.keys(strippedAccount).forEach(function (property) {
Expand Down
8 changes: 5 additions & 3 deletions lib/stormpath.js
Expand Up @@ -110,8 +110,6 @@ module.exports.init = function (app, opts) {
helpers.getUser(req, res, next);
}



// Build routes.
client.on('ready', function () {
var config = app.get('stormpathConfig');
Expand Down Expand Up @@ -243,6 +241,11 @@ function getUserMiddlewareProxy(nextMiddleware) {
*/
module.exports.loginRequired = getUserMiddlewareProxy(middleware.loginRequired);

/**
* Expose the `getUser` middleware.
*
* @property getUser
*/
module.exports.getUser = helpers.getUser;

/**
Expand All @@ -254,7 +257,6 @@ module.exports.groupsRequired = function groupsRequiredProxy() {
return getUserMiddlewareProxy(middleware.groupsRequired.apply(null, arguments));
};


/**
* Expose the `apiAuthenticationRequired` middleware.
*
Expand Down
3 changes: 1 addition & 2 deletions test/handlers/test-me.js
Expand Up @@ -80,8 +80,7 @@ describe('current user (/me) route', function () {
// Custom data should have been expanded:
assert(res.body.customData.favoriteColor === newUser.customData.favoriteColor);

// All other properties should be stripped

// All other properties should be stripped.
assert.equal(res.body.accessTokens, undefined);
assert.equal(res.body.apiKeys, undefined);
assert.equal(res.body.applications, undefined);
Expand Down

0 comments on commit 698d43f

Please sign in to comment.