Skip to content

Commit

Permalink
Variable name change.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbyoung committed May 1, 2014
1 parent ba4bbf4 commit 8a0361d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ exports.middleware.token = require('./auth/types/token');
exports.middleware.user = function() {
return function(req, res, next) {
q()
.then(function() { return User.find(req.auth.query); })
.then(function() { return User.find(req.auth.userQuery); })
.then(function(user) { req.user = user; next(); })
.fail(function() { next(); })
.done();
Expand Down
7 changes: 4 additions & 3 deletions lib/auth/types/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
*
* This middleware sets the following:
*
* - `req.auth.id` - the value of the signed `auth-id` cookie
* - `req.auth.query` - a query that will find the authenticated user
* - `req.auth.id` - the value of the signed `auth-id` cookie.
* - `req.auth.userQuery` is set to a query that will find the authenticated
* user.
* - `res.auth.remember` - a function that sets cookies for remembering the
* user. It sets the following cookies:
* `auth-id` is signed and HTTP only containing the user's identifier.
Expand All @@ -21,7 +22,7 @@ module.exports = function() {
var id = req.signedCookies['auth-id'];
req.auth = {
id: id,
query: { 'id': id }
userQuery: { 'id': id }
};
res.auth = {
remember: function(user) {
Expand Down
7 changes: 4 additions & 3 deletions lib/auth/types/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ var _tkd = 'token_digest';
*
* This middleware does the following:
*
* - `req.auth.token` is set to the value of the `auth-token` HTTP header
* - `req.auth.query` is set to a query that will find the authenticated user
* - `req.auth.token` is set to the value of the `auth-token` HTTP header.
* - `req.auth.userQuery` is set to a query that will find the authenticated
* user
* - `res.auth.remember` - a function that creates a token for remembering a
* user and and adds it to the HTTP headers. When called, the user will have
* an additional property, `token_digest`, set, and the HTTP response header
Expand All @@ -31,7 +32,7 @@ module.exports = function() {
var digest = token && utils.digest(token);
req.auth = {
token: token,
query: { 'token_digest': digest }
userQuery: { 'token_digest': digest }
};
res.auth = {
remember: function(user) {
Expand Down

0 comments on commit 8a0361d

Please sign in to comment.