Skip to content

Commit

Permalink
User ID middleware now uses .findById
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanbiala committed Jan 20, 2015
1 parent 7b7b73d commit 121c38e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ var _ = require('lodash'),
* User middleware
*/
exports.userByID = function(req, res, next, id) {
User.findOne({
_id: id
}).exec(function(err, user) {
User.findById(id).exec(function(err, user) {
if (err) return next(err);
if (!user) return next(new Error('Failed to load User ' + id));
req.profile = user;
Expand Down Expand Up @@ -51,4 +49,4 @@ exports.hasAuthorization = function(roles) {
}
});
};
};
};

0 comments on commit 121c38e

Please sign in to comment.