6
6
use Laravel \Fortify \Actions \DisableTwoFactorAuthentication ;
7
7
use Laravel \Fortify \Actions \EnableTwoFactorAuthentication ;
8
8
use Laravel \Fortify \Actions \GenerateNewRecoveryCodes ;
9
+ use Laravel \Fortify \Features ;
9
10
use Laravel \Jetstream \ConfirmsPasswords ;
10
11
use Livewire \Component ;
11
12
@@ -35,7 +36,9 @@ class TwoFactorAuthenticationForm extends Component
35
36
*/
36
37
public function enableTwoFactorAuthentication (EnableTwoFactorAuthentication $ enable )
37
38
{
38
- $ this ->ensurePasswordIsConfirmed ();
39
+ if (Features::optionEnabled (Features::twoFactorAuthentication (), 'confirmPassword ' )) {
40
+ $ this ->ensurePasswordIsConfirmed ();
41
+ }
39
42
40
43
$ enable (Auth::user ());
41
44
@@ -50,7 +53,9 @@ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $ena
50
53
*/
51
54
public function showRecoveryCodes ()
52
55
{
53
- $ this ->ensurePasswordIsConfirmed ();
56
+ if (Features::optionEnabled (Features::twoFactorAuthentication (), 'confirmPassword ' )) {
57
+ $ this ->ensurePasswordIsConfirmed ();
58
+ }
54
59
55
60
$ this ->showingRecoveryCodes = true ;
56
61
}
@@ -63,7 +68,9 @@ public function showRecoveryCodes()
63
68
*/
64
69
public function regenerateRecoveryCodes (GenerateNewRecoveryCodes $ generate )
65
70
{
66
- $ this ->ensurePasswordIsConfirmed ();
71
+ if (Features::optionEnabled (Features::twoFactorAuthentication (), 'confirmPassword ' )) {
72
+ $ this ->ensurePasswordIsConfirmed ();
73
+ }
67
74
68
75
$ generate (Auth::user ());
69
76
@@ -78,7 +85,9 @@ public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate)
78
85
*/
79
86
public function disableTwoFactorAuthentication (DisableTwoFactorAuthentication $ disable )
80
87
{
81
- $ this ->ensurePasswordIsConfirmed ();
88
+ if (Features::optionEnabled (Features::twoFactorAuthentication (), 'confirmPassword ' )) {
89
+ $ this ->ensurePasswordIsConfirmed ();
90
+ }
82
91
83
92
$ disable (Auth::user ());
84
93
}
0 commit comments