Skip to content

Commit c1ff4a5

Browse files
committed
check for feature
1 parent 9ebb099 commit c1ff4a5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Http/Livewire/TwoFactorAuthenticationForm.php

+13-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Laravel\Fortify\Actions\DisableTwoFactorAuthentication;
77
use Laravel\Fortify\Actions\EnableTwoFactorAuthentication;
88
use Laravel\Fortify\Actions\GenerateNewRecoveryCodes;
9+
use Laravel\Fortify\Features;
910
use Laravel\Jetstream\ConfirmsPasswords;
1011
use Livewire\Component;
1112

@@ -35,7 +36,9 @@ class TwoFactorAuthenticationForm extends Component
3536
*/
3637
public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $enable)
3738
{
38-
$this->ensurePasswordIsConfirmed();
39+
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
40+
$this->ensurePasswordIsConfirmed();
41+
}
3942

4043
$enable(Auth::user());
4144

@@ -50,7 +53,9 @@ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $ena
5053
*/
5154
public function showRecoveryCodes()
5255
{
53-
$this->ensurePasswordIsConfirmed();
56+
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
57+
$this->ensurePasswordIsConfirmed();
58+
}
5459

5560
$this->showingRecoveryCodes = true;
5661
}
@@ -63,7 +68,9 @@ public function showRecoveryCodes()
6368
*/
6469
public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate)
6570
{
66-
$this->ensurePasswordIsConfirmed();
71+
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
72+
$this->ensurePasswordIsConfirmed();
73+
}
6774

6875
$generate(Auth::user());
6976

@@ -78,7 +85,9 @@ public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate)
7885
*/
7986
public function disableTwoFactorAuthentication(DisableTwoFactorAuthentication $disable)
8087
{
81-
$this->ensurePasswordIsConfirmed();
88+
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
89+
$this->ensurePasswordIsConfirmed();
90+
}
8291

8392
$disable(Auth::user());
8493
}

0 commit comments

Comments
 (0)