mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Use primary email for the email field
The email provided by the user info in the response from /user is the publicly visible email, which a user can choose to not set. GitHub accounts always have a primary email, so let’s use that one instead.
This commit is contained in:
committed by
Martijn Walraven
parent
7581cd398f
commit
3833be8bc1
@@ -5,12 +5,13 @@ OAuth.registerService('github', 2, null, function(query) {
|
||||
var accessToken = getAccessToken(query);
|
||||
var identity = getIdentity(accessToken);
|
||||
var emails = getEmails(accessToken);
|
||||
var primaryEmail = _.findWhere(emails, {primary: true});
|
||||
|
||||
return {
|
||||
serviceData: {
|
||||
id: identity.id,
|
||||
accessToken: OAuth.sealSecret(accessToken),
|
||||
email: identity.email,
|
||||
email: primaryEmail.email,
|
||||
username: identity.login,
|
||||
emails: emails
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user