diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php index 39813a50d7..0f7d130e91 100644 --- a/app/Http/Livewire/OauthClients.php +++ b/app/Http/Livewire/OauthClients.php @@ -2,9 +2,11 @@ namespace App\Http\Livewire; +use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; use Laravel\Passport\Client; use Laravel\Passport\ClientRepository; +use Laravel\Passport\TokenRepository; use Livewire\Component; class OauthClients extends Component @@ -18,10 +20,12 @@ class OauthClients extends Component public $authorizationError; protected $clientRepository; + protected $tokenRepository; public function __construct() { $this->clientRepository = app(ClientRepository::class); + $this->tokenRepository = app(TokenRepository::class); parent::__construct(); } @@ -29,6 +33,7 @@ class OauthClients extends Component { return view('livewire.oauth-clients', [ 'clients' => $this->clientRepository->activeForUser(auth()->user()->id), + 'authorized_tokens' => $this->tokenRepository->forUser(auth()->user()->id)->where('revoked', false), ]); } @@ -60,6 +65,17 @@ class OauthClients extends Component } } + public function deleteToken($tokenId): void + { + $token = $this->tokenRepository->find($tokenId); + if ($token->user_id == auth()->user()->id) { + $this->tokenRepository->revokeAccessToken($tokenId); + } else { + Log::warning('User ' . auth()->user()->id . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->user_id); + $this->authorizationError = 'You are not authorized to delete this token.'; + } + } + public function editClient(Client $editClientId): void { $this->editName = $editClientId->name; diff --git a/resources/assets/js/components/passport/AuthorizedClients.vue b/resources/assets/js/components/passport/AuthorizedClients.vue deleted file mode 100644 index f6bd92dbd8..0000000000 --- a/resources/assets/js/components/passport/AuthorizedClients.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - diff --git a/resources/assets/js/components/select2.vue b/resources/assets/js/components/select2.vue deleted file mode 100644 index 7b679800e9..0000000000 --- a/resources/assets/js/components/select2.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - diff --git a/resources/assets/js/vue.js b/resources/assets/js/vue.js index a70c700133..f70169c890 100644 --- a/resources/assets/js/vue.js +++ b/resources/assets/js/vue.js @@ -16,10 +16,10 @@ require('./bootstrap'); // require('./components/passport/Clients.vue').default // ); -Vue.component( - 'passport-authorized-clients', - require('./components/passport/AuthorizedClients.vue').default -); +// Vue.component( +// 'passport-authorized-clients', +// require('./components/passport/AuthorizedClients.vue').default +// ); // This component has been removed and replaced with a Livewire implementation // Vue.component( diff --git a/resources/views/livewire/oauth-clients.blade.php b/resources/views/livewire/oauth-clients.blade.php index be03c3518f..e46406bad5 100644 --- a/resources/views/livewire/oauth-clients.blade.php +++ b/resources/views/livewire/oauth-clients.blade.php @@ -80,6 +80,55 @@ @endif +
+ @if ($authorized_tokens->count() > 0) +
+
+

(Livewire) Authorized Applications

+ +
+ + + + + + + + + + + + @foreach($authorized_tokens as $token) + + + + + + + + + + + @endforeach + +
NameScopesDelete
+ {{ $token->client->name }} + + @if(!$token->scopes) + No Scopes + @endif + + + + +
+
+
+
+ @endif +
diff --git a/resources/views/settings/api.blade.php b/resources/views/settings/api.blade.php index b0cc229a94..2ea559dbbb 100644 --- a/resources/views/settings/api.blade.php +++ b/resources/views/settings/api.blade.php @@ -15,7 +15,6 @@ @if (!config('app.lock_passwords'))
-
@else

{{ trans('general.feature_disabled') }}

diff --git a/resources/views/vendor/passport/authorize.blade.php b/resources/views/vendor/passport/authorize.blade.php index 8565c2d24b..cdf3285298 100644 --- a/resources/views/vendor/passport/authorize.blade.php +++ b/resources/views/vendor/passport/authorize.blade.php @@ -9,7 +9,7 @@ {{ config('app.name') }} - Authorization {{-- stylesheets --}} - +