Skip to content

Commit

Permalink
Fixed Issue: Undefined index: emails
Browse files Browse the repository at this point in the history
Problem:
    PHP Notice – yii\base\ErrorException
    Undefined index: emails
Since Google + Api isn't accepting new domains, it returns `email` instead of `emails` from the people API
  • Loading branch information
imtiazmahbub authored Nov 10, 2019
1 parent 4f46064 commit 31509de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ protected function setInfoGoogle($attributes)
$user = $this->module->model("User");
$profile = $this->module->model("Profile");

$user->email = $attributes["emails"][0]["value"];
$profile->full_name = "{$attributes["name"]["givenName"]} {$attributes["name"]["familyName"]}";
$user->email = isset($attributes["email"]) ? $attributes["email"] : $attributes["emails"][0]["value"];
$profile->full_name = isset($attributes["name"]["givenName"]) ? "{$attributes["name"]["givenName"]} {$attributes["name"]["familyName"]}" : $attributes["name"];

return [$user, $profile];
}
Expand Down

0 comments on commit 31509de

Please sign in to comment.