Skip to content

Commit

Permalink
Merge pull request #167 from muzehyun/issue-frontend-37
Browse files Browse the repository at this point in the history
topcoderinc/dsp-frontend#37 return provider object after login
  • Loading branch information
gondzo authored Jan 10, 2017
2 parents f46daca + a9cebea commit 4f411f6
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 4f411f6

Please sign in to comment.