-
-
Notifications
You must be signed in to change notification settings - Fork 268
Passkeys #2192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Passkeys #2192
Changes from 19 commits
52d2ffb
e60784b
d051f4c
13961c8
02e5644
3aaba31
64799cd
816ad1f
d87aa2d
6906381
e51f3c7
c57a54f
378c4dd
a045eaf
33792a1
a2704f7
e16a3d8
0c47ec2
5029e57
80dbcfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
||
|
|
||
| namespace App\Livewire; | ||
|
|
||
| use Filament\Actions\Action; | ||
| use Filament\Actions\Concerns\InteractsWithActions; | ||
| use Filament\Actions\Contracts\HasActions; | ||
| use Filament\Notifications\Notification; | ||
| use Filament\Schemas\Concerns\InteractsWithSchemas; | ||
| use Filament\Schemas\Contracts\HasSchemas; | ||
| use Illuminate\View\View; | ||
| use Spatie\LaravelPasskeys\Livewire\PasskeysComponent; | ||
|
|
||
| final class Passkeys extends PasskeysComponent implements HasActions, HasSchemas | ||
| { | ||
| use InteractsWithActions; | ||
| use InteractsWithSchemas; | ||
|
|
||
| public function confirmDelete(int $passkeyId): void | ||
| { | ||
| $this->mountAction('deleteAction', ['passkey' => $passkeyId]); | ||
| } | ||
|
|
||
| public function deleteAction(): Action | ||
| { | ||
| return Action::make('deleteAction') | ||
| ->label(trans('passkeys.delete')) | ||
| ->color('danger') | ||
| ->requiresConfirmation() | ||
| ->action(fn (array $arguments) => $this->deletePasskey((int) $arguments['passkey'])); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public function deletePasskey(int $passkeyId): void | ||
| { | ||
| $this->currentUser()->passkeys()->findOrFail($passkeyId); | ||
|
|
||
| parent::deletePasskey($passkeyId); | ||
|
|
||
| Notification::make() | ||
| ->title(trans('passkeys.deleted_notification_title')) | ||
| ->success() | ||
| ->send(); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public function storePasskey(string $passkey): void | ||
| { | ||
| parent::storePasskey($passkey); | ||
|
|
||
| Notification::make() | ||
| ->title(trans('passkeys.created_notification_title')) | ||
| ->success() | ||
| ->send(); | ||
| } | ||
|
|
||
| public function render(): View | ||
| { | ||
| return view('passkeys.livewire.passkeys', data: [ | ||
| 'passkeys' => $this->currentUser()->passkeys()->get(), | ||
| ]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| use App\Enums\CustomizationKey; | ||
| use App\Enums\TablerIcon; | ||
| use App\Livewire\Passkeys; | ||
| use Filament\Actions\Action; | ||
| use Filament\Actions\CreateAction; | ||
| use Filament\Actions\DeleteAction; | ||
|
|
@@ -64,6 +65,11 @@ public function boot(): void | |
| fn () => Blade::render('filament.layouts.footer'), | ||
| ); | ||
|
|
||
| FilamentView::registerRenderHook( | ||
| PanelsRenderHook::AUTH_LOGIN_FORM_AFTER, | ||
|
||
| fn () => view('passkeys.login'), | ||
| ); | ||
|
|
||
| FilamentView::registerRenderHook( | ||
| PanelsRenderHook::STYLES_BEFORE, | ||
| fn () => Blade::render("@vite(['resources/css/app.css'])") | ||
|
|
@@ -257,6 +263,7 @@ public function boot(): void | |
|
|
||
| SchemaIconAlias::COMPONENTS_WIZARD_COMPLETED_STEP => TablerIcon::Check, | ||
| ]); | ||
| Livewire::component('filament-passkeys', Passkeys::class); | ||
| } | ||
|
|
||
| public function register(): void {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ | |
| use Illuminate\Contracts\Auth\Factory as AuthFactory; | ||
| use Illuminate\Database\ConnectionInterface; | ||
| use Illuminate\Database\Eloquent\Model; | ||
| use Illuminate\Support\Arr; | ||
| use Illuminate\Support\Collection; | ||
| use Illuminate\Support\Facades\Request; | ||
| use Throwable; | ||
|
|
@@ -71,7 +70,7 @@ public function description(?string $description): self | |
| */ | ||
| public function subject(...$subjects): self | ||
| { | ||
| foreach (Arr::wrap($subjects) as $subject) { | ||
| foreach ($subjects as $subject) { | ||
|
||
| if (is_null($subject)) { | ||
| continue; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should be adding a view like this. iirc there is a
Viewcomponent from filament.