1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Catch if an OAuth user doesn't exist and attempts to login

This commit is contained in:
David Bomba 2021-02-28 19:54:14 +11:00
parent fa5830f37b
commit 92f729c10d

View File

@ -286,11 +286,25 @@ class LoginController extends BaseController
}
if ($user) {
$client = new Google_Client();
$client->setClientId(config('ninja.auth.google.client_id'));
$client->setClientSecret(config('ninja.auth.google.client_secret'));
$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 = '';