diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php index 55ace88374..98582c0725 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 b98eb6283c..bb43fccbdb 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'))