Skip to content

Commit

Permalink
Update ConnectController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhollmann committed Jun 22, 2024
1 parent 570f4a2 commit a54bbdb
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions app/Access/Controllers/ConnectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,9 @@ public function login(Request $request)
// Initiation state is without 'code' and 'state'
if (!$request->has('code') || !$request->has('state')) {
try {
// Initiate the authentication process using VATSIM Connect
// 1. Test if the service is available at all.
// 2. If available: Prepare the authentication url and send the user away to it
$response = \Illuminate\Support\Facades\Http::timeout(30)->get(config('vatsim.authentication.connect.base'));
if ($response->status() < 500 || $response->status() > 599) {
$authenticationUrl = $this->provider->getAuthorizationUrl();
$request->session()->put('authentication.connect.state', $this->provider->getState());
return redirect()->away($authenticationUrl);
} else {
// Send the user to the service unavailable page
return redirect('/')->withErrors('Connect error');
}
$authenticationUrl = $this->provider->getAuthorizationUrl();
$request->session()->put('authentication.connect.state', $this->provider->getState());
return redirect()->away($authenticationUrl);
} catch (\Illuminate\Http\Client\ConnectionException $ce) {
// Send the user to the service unavailable page
return redirect('/')->withErrors('Connect error');
Expand Down

0 comments on commit a54bbdb

Please sign in to comment.