mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 05:44:37 -04:00
Catch if an OAuth user doesn't exist and attempts to login
This commit is contained in:
parent
fa5830f37b
commit
92f729c10d
@ -286,11 +286,25 @@ class LoginController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
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'));
|
||||||
$client->setRedirectUri(config('ninja.app_url'));
|
$client->setRedirectUri(config('ninja.app_url'));
|
||||||
$token = $client->authenticate(request()->input('server_auth_code'));
|
|
||||||
|
$token = false;
|
||||||
|
|
||||||
|
try{
|
||||||
|
$token = $client->authenticate(request()->input('server_auth_code'));
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
|
||||||
|
return response()
|
||||||
|
->json(['message' => ctrans('texts.invalid_credentials')], 401)
|
||||||
|
->header('X-App-Version', config('ninja.app_version'))
|
||||||
|
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$refresh_token = '';
|
$refresh_token = '';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user