mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:54:38 -04:00
Fixes for connected account
This commit is contained in:
parent
816ea281ff
commit
aef2270f05
@ -89,23 +89,8 @@ class ConnectedAccountController extends BaseController
|
|||||||
|
|
||||||
$user = $google->getTokenResponse(request()->input('id_token'));
|
$user = $google->getTokenResponse(request()->input('id_token'));
|
||||||
|
|
||||||
if (is_array($user)) {
|
|
||||||
|
|
||||||
$query = [
|
|
||||||
'oauth_user_id' => $google->harvestSubField($user),
|
|
||||||
'oauth_provider_id'=> 'google',
|
|
||||||
];
|
|
||||||
|
|
||||||
/* Cannot allow duplicates! */
|
|
||||||
if ($existing_user = MultiDB::hasUser($query)) {
|
|
||||||
return response()
|
|
||||||
->json(['message' => 'User already exists in system.'], 401)
|
|
||||||
->header('X-App-Version', config('ninja.app_version'))
|
|
||||||
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
|
|
||||||
$client = new Google_Client();
|
$client = new Google_Client();
|
||||||
$client->setClientId(config('ninja.auth.google.client_id'));
|
$client->setClientId(config('ninja.auth.google.client_id'));
|
||||||
$client->setClientSecret(config('ninja.auth.google.client_secret'));
|
$client->setClientSecret(config('ninja.auth.google.client_secret'));
|
||||||
@ -118,7 +103,6 @@ class ConnectedAccountController extends BaseController
|
|||||||
$refresh_token = $token['refresh_token'];
|
$refresh_token = $token['refresh_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$connected_account = [
|
$connected_account = [
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'email' => $google->harvestEmail($user),
|
'email' => $google->harvestEmail($user),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user