diff --git a/models/User.js b/models/User.js index 0aa6adf..3f73786 100644 --- a/models/User.js +++ b/models/User.js @@ -49,7 +49,7 @@ if (!UserSchema.options.toObject) { * @param {Object} options the transform options */ UserSchema.options.toObject.transform = function (doc, ret, options) { // eslint-disable-line no-unused-vars - const sanitized = _.omit(ret, '__v', '_id', 'password', 'provider', 'createdAt', 'updatedAt'); + const sanitized = _.omit(ret, '__v', '_id', 'password', 'createdAt', 'updatedAt'); sanitized.id = doc._id; return sanitized; }; diff --git a/services/UserService.js b/services/UserService.js index 255545a..cd270c1 100644 --- a/services/UserService.js +++ b/services/UserService.js @@ -184,7 +184,7 @@ function* generateToken(userObj) { */ function* login(entity) { // validate that email and password is valid, generate token - const user = yield User.findOne({email: entity.email}); + const user = yield User.findOne({email: entity.email}).populate('provider').exec(); if (!user) { throw new errors.NotFoundError('user not found with the specified email'); }