Skip to content

Commit

Permalink
fix connect controller
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhollmann committed Aug 26, 2023
1 parent 351acfc commit 0530f90
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/Access/Controllers/VATSIMConnectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public function login(Request $request)

/**
* Check that all required data is received from the VATSIM Connect authentication system
*
* @param Request
* @return RedirectResponse|Redirect
*/
protected function _verifyLogin(Request $request)
{
Expand All @@ -103,11 +100,6 @@ protected function _verifyLogin(Request $request)
if (!isset($resourceOwner->data) || !isset($resourceOwner->data->cid) || !isset($resourceOwner->data->personal->name_first) || !isset($resourceOwner->data->personal->name_last) || !isset($resourceOwner->data->personal->email) || $resourceOwner->data->oauth->token_valid !== "true") {
return redirect()->route('vatsim.authentication.connect.failed');
}

if (User::query()->where('email', $resourceOwner->data->personal->email)->exists()) {
return redirect()->route('vatsim.authentication.connect.failed');
}

// All checks completed. Let's finally sign in the user
$user = $this->_completeLogin($resourceOwner, $accessToken);

Expand Down Expand Up @@ -180,9 +172,9 @@ protected function _completeLogin($resourceOwner, $accessToken)
* Display a failed message and then return to the login
*
*/
public function failed(Request $request): RedirectResponse
public function failed(): RedirectResponse
{
return redirect('/')->withErrors('Error logging in. Please try again.');
return redirect('/')->with('error','Error logging in. Please try again.');
}

/**
Expand Down

0 comments on commit 0530f90

Please sign in to comment.