From 38a0dcddd333abd0f2fd084d6106abc1bafe95ca Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Tue, 22 Oct 2024 15:28:59 +0200 Subject: [PATCH] improve recovery code sync using vanilla javascript instead of livewire --- src/Http/Livewire/Auth/LoginTwoFactor.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Http/Livewire/Auth/LoginTwoFactor.php b/src/Http/Livewire/Auth/LoginTwoFactor.php index 9a864a5..8861322 100644 --- a/src/Http/Livewire/Auth/LoginTwoFactor.php +++ b/src/Http/Livewire/Auth/LoginTwoFactor.php @@ -37,8 +37,6 @@ class LoginTwoFactor extends Page implements HasActions, HasForms public ?string $code = null; - public ?string $recovery_code = null; - #[Reactive] public int $lastResendTime = 0; @@ -73,8 +71,8 @@ public function resend(): Action ->color('primary') ->extraAttributes(['class' => 'w-full text-xs']) ->link() - ->disabled(fn () => ! $this->canResend()) - ->action(fn () => $this->handleResend()); + ->disabled(fn() => ! $this->canResend()) + ->action(fn() => $this->handleResend()); } public function handleResend(): void @@ -135,9 +133,8 @@ protected function getFormSchema(): array ->extraInputAttributes([ 'name' => 'code', 'autocomplete' => 'one-time-code', - ]) - ->afterStateUpdated(fn (Set $set, ?string $state) => $set('recovery_code', $state)) - ->live(), + 'onchange' => 'document.getElementById("recovery_code").value = this.value' + ]), ]; } }