From 31509de1acfb22841e0c04f288f84d1918eb0d5c Mon Sep 17 00:00:00 2001 From: Imtiaz Mahbub Date: Sun, 10 Nov 2019 13:59:15 +0600 Subject: [PATCH] Fixed Issue: Undefined index: emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- controllers/AuthController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/AuthController.php b/controllers/AuthController.php index f566cfa..cc378df 100644 --- a/controllers/AuthController.php +++ b/controllers/AuthController.php @@ -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]; }