Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
fix(users) Handle missing email - OAuth (#1501)
Browse files Browse the repository at this point in the history
* fix(users) patch OAuth default email issue

- Intentionally omits setting email in constructor to trigger defaults when
creating user. Handles cases where email is not authorized/given by provider.

Related to issue #1250
  • Loading branch information
Wuntenn authored and mleanos committed Sep 21, 2016
1 parent 89e8d13 commit e3eafa6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,16 @@ exports.saveOAuthUserProfile = function (req, providerUserProfile, done) {
lastName: providerUserProfile.lastName,
username: availableUsername,
displayName: providerUserProfile.displayName,
email: providerUserProfile.email,
profileImageURL: providerUserProfile.profileImageURL,
provider: providerUserProfile.provider,
providerData: providerUserProfile.providerData
});

// Email intentionally added later to allow defaults (sparse settings) to be applid.
// Handles case where no email is supplied.
// See comment: https://github.com/meanjs/mean/pull/1495#issuecomment-246090193
user.email = providerUserProfile.email;

// And save the user
user.save(function (err) {
return done(err, user, info);
Expand Down

0 comments on commit e3eafa6

Please sign in to comment.