1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop

This commit is contained in:
Hillel Coren 2017-08-08 07:21:53 +03:00
commit 07296fae9b
2 changed files with 7 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class OAuth {
$user = null;
if($this->providerInstance)
$user = User::where('email', $this->providerInstance->getTokenResponse($token))->first();
$user = User::where('oauth_user_id', $this->providerInstance->getTokenResponse($token))->first();
if ($user)
return $user;

View File

@ -9,7 +9,7 @@ class Google implements ProviderInterface
$client = new \Google_Client(['client_id' => env('GOOGLE_CLIENT_ID','')]);
$payload = $client->verifyIdToken($token);
if ($payload)
return $this->harvestEmail($payload);
return $this->harvestSubField($payload);
else
return null;
}
@ -19,5 +19,9 @@ class Google implements ProviderInterface
return $payload['email'];
}
private function harvestSubField($payload)
{
$data = $payload->getAttributes();
return $data['payload']['sub']; // user ID
}
}