mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-12 15:10:28 +01:00
User ID middleware now uses .findById
This commit is contained in:
@@ -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;
|
||||
@@ -51,4 +49,4 @@ exports.hasAuthorization = function(roles) {
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user