Adds check to see if email was verified

This commit is contained in:
Maxi Redigonda 2020-08-22 00:47:24 -03:00
parent 9f915a3291
commit a89a465ac9
1 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ class LoginController extends Controller {
if ($this->checkGoogleLogin()) {
$client = new Google_Client(['client_id' => '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com']);
$payload = $client->verifyIdToken(Controller::request('googleId'));
if ($payload) {
if ($payload && $payload['email_verified']) {
$this->userInstance = User::getUser($payload['email'], 'email');
if ($this->userInstance->isNull()) {
@ -65,7 +65,7 @@ class LoginController extends Controller {
Response::respondSuccess($this->getUserData());
return;
} else {
throw new Exception("Invalid GoogleID token");
throw new Exception("Invalid GoogleID token or unverified Google account");
}
}