diff --git a/src/Http/Livewire/Auth/LoginTwoFactor.php b/src/Http/Livewire/Auth/LoginTwoFactor.php index d5db3ca..76e69a3 100644 --- a/src/Http/Livewire/Auth/LoginTwoFactor.php +++ b/src/Http/Livewire/Auth/LoginTwoFactor.php @@ -9,7 +9,6 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Concerns\InteractsWithForms; use Filament\Forms\Contracts\HasForms; -use Filament\Forms\Set; use Filament\Notifications\Notification; use Filament\Pages\Concerns\InteractsWithFormActions; use Filament\Pages\Page; @@ -17,6 +16,7 @@ use Laravel\Fortify\Http\Requests\TwoFactorLoginRequest; use Livewire\Attributes\Computed; use Livewire\Attributes\Reactive; +use Vormkracht10\TwoFactorAuth\Enums\TwoFactorType; use Vormkracht10\TwoFactorAuth\Notifications\SendOTP; class LoginTwoFactor extends Page implements HasActions, HasForms @@ -44,9 +44,8 @@ public function mount(TwoFactorLoginRequest $request): void { if ($request->challengedUser()) { $this->challengedUser = $request->challengedUser(); - $this->twoFactorType = $this->challengedUser->two_factor_type->value; + $this->twoFactorType = $this->challengedUser->two_factor_type?->value ?? TwoFactorType::email->value; - // Set initial cooldown if not already set if (! Cache::has('resend_cooldown_' . $this->challengedUser->id)) { Cache::put('resend_cooldown_' . $this->challengedUser->id, true, now()->addSeconds(30)); }