Skip to content

Commit b314f93

Browse files
committed
More Fixes
1 parent 52b681e commit b314f93

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

resources/js/pages/settings/TwoFactor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const breadcrumbs: BreadcrumbItem[] = [
3131
];
3232
3333
const { qrCodeSvg, manualSetupKey } = useTwoFactorAuth();
34-
const showSetupModal = ref(false);
34+
const showSetupModal = ref<boolean>(false);
3535
const setupModalRef = ref<InstanceType<typeof TwoFactorSetupModal>>();
3636
</script>
3737

tests/Feature/Auth/AuthenticationTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AuthenticationTest extends TestCase
1313

1414
public function test_login_screen_can_be_rendered()
1515
{
16-
$response = $this->get('/login');
16+
$response = $this->get(route('login'));
1717

1818
$response->assertStatus(200);
1919
}
@@ -22,7 +22,7 @@ public function test_users_can_authenticate_using_the_login_screen()
2222
{
2323
$user = User::factory()->create();
2424

25-
$response = $this->post('/login', [
25+
$response = $this->post(route('login'), [
2626
'email' => $user->email,
2727
'password' => 'password',
2828
]);
@@ -50,12 +50,12 @@ public function test_users_with_two_factor_enabled_are_redirected_to_two_factor_
5050
'two_factor_confirmed_at' => now(),
5151
])->save();
5252

53-
$response = $this->post('/login', [
53+
$response = $this->post(route('login'), [
5454
'email' => $user->email,
5555
'password' => 'password',
5656
]);
5757

58-
$response->assertRedirect('/two-factor-challenge');
58+
$response->assertRedirect(route('two-factor.login'));
5959
$response->assertSessionHas('login.id', $user->id);
6060
$this->assertGuest();
6161
}
@@ -64,7 +64,7 @@ public function test_users_without_two_factor_enabled_login_normally()
6464
{
6565
$user = User::factory()->create();
6666

67-
$response = $this->post('/login', [
67+
$response = $this->post(route('login'), [
6868
'email' => $user->email,
6969
'password' => 'password',
7070
]);
@@ -78,7 +78,7 @@ public function test_users_can_not_authenticate_with_invalid_password()
7878
{
7979
$user = User::factory()->create();
8080

81-
$this->post('/login', [
81+
$this->post(route('login'), [
8282
'email' => $user->email,
8383
'password' => 'wrong-password',
8484
]);
@@ -90,26 +90,26 @@ public function test_users_can_logout()
9090
{
9191
$user = User::factory()->create();
9292

93-
$response = $this->actingAs($user)->post('/logout');
93+
$response = $this->actingAs($user)->post(route('logout'));
9494

9595
$this->assertGuest();
96-
$response->assertRedirect('/');
96+
$response->assertRedirect(route('home'));
9797
}
9898

9999
public function test_users_are_rate_limited()
100100
{
101101
$user = User::factory()->create();
102102

103103
for ($i = 0; $i < 5; $i++) {
104-
$this->post('/login', [
104+
$this->post(route('login'), [
105105
'email' => $user->email,
106106
'password' => 'wrong-password',
107107
])->assertStatus(302)->assertSessionHasErrors([
108108
'email' => 'These credentials do not match our records.',
109109
]);
110110
}
111111

112-
$response = $this->post('/login', [
112+
$response = $this->post(route('login'), [
113113
'email' => $user->email,
114114
'password' => 'wrong-password',
115115
]);

tests/Feature/Auth/TwoFactorChallengeTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ public function test_two_factor_authentication_is_rate_limited(): void
8181
foreach (range(0, 4) as $ignored) {
8282
$this->post(route('two-factor.login.store'), [
8383
'code' => '000000',
84-
])->assertStatus(302)->assertSessionHasErrors([
85-
'code' => 'The provided two factor authentication code was invalid.',
86-
]);
84+
])->assertSessionHasErrors('code');
8785
}
8886

8987
$response = $this->post(route('two-factor.login.store'), [
9088
'code' => '000000',
9189
]);
9290

93-
$response->assertStatus(429);
91+
$response->assertTooManyRequests();
9492
}
9593
}

0 commit comments

Comments
 (0)