File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ public function definition(): array
29
29
'email_verified_at ' => now (),
30
30
'password ' => static ::$ password ??= Hash::make ('password ' ),
31
31
'remember_token ' => Str::random (10 ),
32
+ 'two_factor_secret ' => Str::random (10 ),
33
+ 'two_factor_recovery_codes ' => Str::random (10 ),
34
+ 'two_factor_confirmed_at ' => now (),
32
35
];
33
36
}
34
37
@@ -41,4 +44,16 @@ public function unverified(): static
41
44
'email_verified_at ' => null ,
42
45
]);
43
46
}
47
+
48
+ /**
49
+ * Indicate that the model does not have two-factor authentication configured.
50
+ */
51
+ public function withoutTwoFactor (): static
52
+ {
53
+ return $ this ->state (fn (array $ attributes ) => [
54
+ 'two_factor_secret ' => null ,
55
+ 'two_factor_recovery_codes ' => null ,
56
+ 'two_factor_confirmed_at ' => null ,
57
+ ]);
58
+ }
44
59
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function test_login_screen_can_be_rendered()
21
21
22
22
public function test_users_can_authenticate_using_the_login_screen ()
23
23
{
24
- $ user = User::factory ()->create ();
24
+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
25
25
26
26
$ response = $ this ->post (route ('login.store ' ), [
27
27
'email ' => $ user ->email ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function test_two_factor_settings_page_can_be_rendered()
23
23
'confirmPassword ' => true ,
24
24
]);
25
25
26
- $ user = User::factory ()->create ();
26
+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
27
27
28
28
$ this ->actingAs ($ user )
29
29
->withSession (['auth.password_confirmed_at ' => time ()])
You can’t perform that action at this time.
0 commit comments