Skip to content

Commit

Permalink
topcoderinc/dsp-frontend#37 return provider object after login
Browse files Browse the repository at this point in the history
  • Loading branch information
muzehyun committed Jan 9, 2017
1 parent b687593 commit a9cebea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion services/UserService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit a9cebea

Please sign in to comment.