From 12e546e63ac8c209f65229493323b711f050c2de Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 5 Dec 2023 20:22:20 -0600 Subject: [PATCH] everything working, cleanup --- app/Http/Livewire/OauthClients.php | 9 +++++++-- resources/views/livewire/oauth-clients.blade.php | 15 +++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php index 55ace8837..98582c072 100644 --- a/app/Http/Livewire/OauthClients.php +++ b/app/Http/Livewire/OauthClients.php @@ -2,9 +2,9 @@ namespace App\Http\Livewire; +use Illuminate\Support\Facades\Log; use Laravel\Passport\Client; use Laravel\Passport\ClientRepository; -use Laravel\Passport\Passport; use Livewire\Component; class OauthClients extends Component @@ -15,6 +15,8 @@ class OauthClients extends Component public $editName; public $editRedirect; + public $authorizationError; + protected $clientRepository; public function __construct() @@ -58,6 +60,8 @@ class OauthClients extends Component $this->editName = $editClientId->name; $this->editRedirect = $editClientId->redirect; + $this->editClientId = $editClientId->id; + $this->dispatchBrowserEvent('editClient'); } @@ -74,7 +78,8 @@ class OauthClients extends Component $client->redirect = $this->editRedirect; $client->save(); } else { - // throw error + Log::warning('User ' . auth()->user()->id . ' attempted to edit client ' . $editClientId->id . ' which belongs to user ' . $client->user_id); + $this->authorizationError = 'You are not authorized to edit this client.'; } $this->dispatchBrowserEvent('clientUpdated'); diff --git a/resources/views/livewire/oauth-clients.blade.php b/resources/views/livewire/oauth-clients.blade.php index b98eb6283..bb43fccbd 100644 --- a/resources/views/livewire/oauth-clients.blade.php +++ b/resources/views/livewire/oauth-clients.blade.php @@ -183,6 +183,9 @@ @if($errors->has('newRedirect'))
  • {{ $errors->first('newRedirect') }}
  • @endif + @if($authCodeError) +
  • {{ $authorizationError }}
  • + @endif @endif @@ -233,7 +236,7 @@