Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\In;
use ResourceBundle;
use Spatie\LaravelPasskeys\Models\Concerns\HasPasskeys;
use Spatie\LaravelPasskeys\Models\Concerns\InteractsWithPasskeys;
use Spatie\Permission\Traits\HasRoles;

/**
Expand Down Expand Up @@ -94,7 +96,7 @@
* @method static Builder|User whereUsername($value)
* @method static Builder|User whereUuid($value)
*/
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery, HasAvatar, HasEmailAuthentication, HasName, HasTenants, Validatable
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery, HasAvatar, HasEmailAuthentication, HasName, HasPasskeys, HasTenants, Validatable
{
use Authenticatable;
use Authorizable { can as protected canned; }
Expand All @@ -103,6 +105,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
use HasFactory;
use HasRoles;
use HasValidation { getRules as getValidationRules; }
use InteractsWithPasskeys;
use Notifiable;

public const USER_LEVEL_USER = 0;
Expand Down Expand Up @@ -504,4 +507,14 @@ public function toggleEmailAuthentication(bool $condition): void
{
$this->update(['mfa_email_enabled' => $condition]);
}

public function getPasskeyDisplayName(): string
{
return $this->username ?? $this->email;
}

public function getPasskeyUserId(): int
{
return $this->id;
}
}
2 changes: 2 additions & 0 deletions app/Providers/Filament/FilamentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Illuminate\Support\ServiceProvider;
use Livewire\Component;
use Livewire\Livewire;
use MarcelWeidum\Passkeys\Livewire\Passkeys as FilamentPasskeys;

use function Livewire\on;
use function Livewire\store;
Expand Down Expand Up @@ -257,6 +258,7 @@ public function boot(): void

SchemaIconAlias::COMPONENTS_WIZARD_COMPLETED_STEP => TablerIcon::Check,
]);
Livewire::component('filament-passkeys', FilamentPasskeys::class);
}

public function register(): void {}
Expand Down
4 changes: 4 additions & 0 deletions app/Providers/Filament/PanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use MarcelWeidum\Passkeys\PasskeysPlugin;

abstract class PanelProvider extends BasePanelProvider
{
Expand Down Expand Up @@ -56,6 +57,9 @@ public function panel(Panel $panel): Panel
AppAuthentication::make()->recoverable(),
EmailAuthentication::make(),
])
->plugins([
PasskeysPlugin::make(),
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"lcobucci/jwt": "^5.6",
"league/flysystem-aws-s3-v3": "^3.31",
"league/flysystem-memory": "^3.31",
"marcelweidum/filament-passkeys": "^2.0",
"phiki/phiki": "^2.0",
"phpseclib/phpseclib": "~3.0.18",
"predis/predis": "^2.3",
Expand Down
Loading