Adds check to see if email was verified
This commit is contained in:
parent
9f915a3291
commit
a89a465ac9
|
@ -54,7 +54,7 @@ class LoginController extends Controller {
|
||||||
if ($this->checkGoogleLogin()) {
|
if ($this->checkGoogleLogin()) {
|
||||||
$client = new Google_Client(['client_id' => '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com']);
|
$client = new Google_Client(['client_id' => '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com']);
|
||||||
$payload = $client->verifyIdToken(Controller::request('googleId'));
|
$payload = $client->verifyIdToken(Controller::request('googleId'));
|
||||||
if ($payload) {
|
if ($payload && $payload['email_verified']) {
|
||||||
$this->userInstance = User::getUser($payload['email'], 'email');
|
$this->userInstance = User::getUser($payload['email'], 'email');
|
||||||
|
|
||||||
if ($this->userInstance->isNull()) {
|
if ($this->userInstance->isNull()) {
|
||||||
|
@ -65,7 +65,7 @@ class LoginController extends Controller {
|
||||||
Response::respondSuccess($this->getUserData());
|
Response::respondSuccess($this->getUserData());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Invalid GoogleID token");
|
throw new Exception("Invalid GoogleID token or unverified Google account");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue