Fix: Return primary email address, not the first #360

Merged
merged 1 commit into from Dec 7, 2014

Projects

None yet

3 participants

@localheinz
Contributor

When a user has multiple email addresses, the first doesn't necessarily have to be the primary email address.

[
    {
        "email": "john@example.org",
        "verified": true,
        "primary": false
    },
    {
        "email": "john.doe@example.com",
        "verified": true,
        "primary": true
    }
]

This PR fixes Hybrid_Providers_GitHub::getUserProfile() by iterating over the array of email addresses to find the one that is the primary email address.

@localheinz localheinz referenced this pull request in zendframework/modules.zendframework.com Dec 7, 2014
Open

When signing up and having multiple email addresses, not the primary one is used #257

@StorytellerCZ
Contributor

Thank you!

@StorytellerCZ StorytellerCZ merged commit 391783f into hybridauth:master Dec 7, 2014
@localheinz localheinz deleted the localheinz:fix/return-primary-email-address branch Dec 7, 2014
@SocalNick
Contributor

@AdwinTrave - do you have a release planned with this fix? I would do it but haven't been as involved and don't want to step on your toes.

Thanks!

@StorytellerCZ StorytellerCZ added this to the 2.x milestone Dec 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment