mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
Fixed GitHub e-mail address lookup
This commit is contained in:
parent
6cc7e4b185
commit
e0e25ea54b
@ -14,6 +14,27 @@ namespace humhub\modules\user\authclient;
|
||||
class GitHub extends \yii\authclient\clients\GitHub
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function normalizeUserAttributes($attributes)
|
||||
{
|
||||
if (!isset($attributes['email'])) {
|
||||
$emails = $this->api('user/emails', 'GET');
|
||||
|
||||
if (is_array($emails)) {
|
||||
foreach ($emails as $email) {
|
||||
if ($email['primary'] == 1 && $email['verified'] == 1) {
|
||||
$attributes['email'] = $email['email'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::normalizeUserAttributes($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user