From c1ff4a55fccf674958a3b0ef5ec97cea81ad4501 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 14 Sep 2020 13:46:36 -0500 Subject: [PATCH] check for feature --- .../Livewire/TwoFactorAuthenticationForm.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Http/Livewire/TwoFactorAuthenticationForm.php b/src/Http/Livewire/TwoFactorAuthenticationForm.php index 58688fa66..ba804f84f 100644 --- a/src/Http/Livewire/TwoFactorAuthenticationForm.php +++ b/src/Http/Livewire/TwoFactorAuthenticationForm.php @@ -6,6 +6,7 @@ use Laravel\Fortify\Actions\DisableTwoFactorAuthentication; use Laravel\Fortify\Actions\EnableTwoFactorAuthentication; use Laravel\Fortify\Actions\GenerateNewRecoveryCodes; +use Laravel\Fortify\Features; use Laravel\Jetstream\ConfirmsPasswords; use Livewire\Component; @@ -35,7 +36,9 @@ class TwoFactorAuthenticationForm extends Component */ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $enable) { - $this->ensurePasswordIsConfirmed(); + if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) { + $this->ensurePasswordIsConfirmed(); + } $enable(Auth::user()); @@ -50,7 +53,9 @@ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $ena */ public function showRecoveryCodes() { - $this->ensurePasswordIsConfirmed(); + if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) { + $this->ensurePasswordIsConfirmed(); + } $this->showingRecoveryCodes = true; } @@ -63,7 +68,9 @@ public function showRecoveryCodes() */ public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate) { - $this->ensurePasswordIsConfirmed(); + if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) { + $this->ensurePasswordIsConfirmed(); + } $generate(Auth::user()); @@ -78,7 +85,9 @@ public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate) */ public function disableTwoFactorAuthentication(DisableTwoFactorAuthentication $disable) { - $this->ensurePasswordIsConfirmed(); + if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) { + $this->ensurePasswordIsConfirmed(); + } $disable(Auth::user()); }