Fix bug when id and email was set to null even if they're was in user response

This commit is contained in:
trogwar
2016-07-01 17:03:32 +03:00
committed by Jack Wall
parent 8f7813faf3
commit 4ea360a0d1

View File

@@ -165,10 +165,10 @@ class Vkontakte extends AbstractProvider
}
protected function createResourceOwner(array $response, AccessToken $token)
{
$response = reset($response['response']);
$additional = $token->getValues();
$response['email'] = !empty($additional['email']) ? $additional['email'] : null;
$response['id'] = !empty($additional['user_id']) ? $additional['user_id'] : null;
$response = reset($response['response']);
$additional = $token->getValues();
if (!empty($additional['email'])) $response['email'] = $additional['email'];
if (!empty($additional['user_id'])) $response['id'] = $additional['user_id'];
return new User($response, $response['id']);
}