Skip to content

Commit 17f4ec7

Browse files
committed
various formatting tweaks
1 parent 2b20426 commit 17f4ec7

12 files changed

+41
-49
lines changed

app/Http/Controllers/Auth/AuthenticatedSessionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function store(LoginRequest $request): RedirectResponse
3838
'login.remember' => $request->boolean('remember'),
3939
]);
4040

41-
return redirect()->route('two-factor.login');
41+
return to_route('two-factor.login');
4242
}
4343

4444
Auth::login($user, $request->boolean('remember'));

app/Http/Controllers/Settings/TwoFactorAuthenticationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function show(TwoFactorAuthenticationRequest $request): Response
3030
$request->validateState();
3131

3232
return Inertia::render('settings/TwoFactor', [
33-
'requiresConfirmation' => Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm'),
3433
'twoFactorEnabled' => $request->user()->hasEnabledTwoFactorAuthentication(),
34+
'requiresConfirmation' => Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm'),
3535
]);
3636
}
3737
}

app/Http/Requests/Auth/TwoFactorAuthenticationRequest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,14 @@ public function validateState(): void
3838

3939
$currentTime = time();
4040

41-
// Notate totally disabled state in session...
4241
if ($this->twoFactorAuthenticationDisabled()) {
4342
$this->session()->put('two_factor_empty_at', $currentTime);
4443
}
4544

46-
// If was previously totally disabled this session but is now confirming, notate time...
4745
if ($this->hasJustBegunConfirmingTwoFactorAuthentication()) {
4846
$this->session()->put('two_factor_confirming_at', $currentTime);
4947
}
5048

51-
// If the profile is reloaded and is not confirmed but was previously in confirming state, disable...
5249
if ($this->neverFinishedConfirmingTwoFactorAuthentication($currentTime)) {
5350
app(DisableTwoFactorAuthentication::class)(Auth::user());
5451

@@ -67,7 +64,7 @@ protected function twoFactorAuthenticationDisabled(): bool
6764
}
6865

6966
/**
70-
* Determine if two-factor authentication is just now being confirmed within the last request cycle.
67+
* Determine if two-factor authentication is being confirmed within the last request cycle.
7168
*/
7269
protected function hasJustBegunConfirmingTwoFactorAuthentication(): bool
7370
{

app/Providers/FortifyServiceProvider.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ public function register(): void
2525
public function boot(): void
2626
{
2727
Fortify::twoFactorChallengeView(fn () => Inertia::render('auth/TwoFactorChallenge'));
28-
2928
Fortify::confirmPasswordView(fn () => Inertia::render('auth/ConfirmPassword'));
3029

31-
RateLimiter::for(
32-
'two-factor',
33-
fn (Request $request) => Limit::perMinute(5)->by($request->session()->get('login.id'))
34-
);
30+
RateLimiter::for('two-factor', function (Request $request) {
31+
return Limit::perMinute(5)->by($request->session()->get('login.id'));
32+
});
3533
}
3634
}

database/migrations/2025_08_14_170933_add_two_factor_columns_to_users_table.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@
1212
public function up(): void
1313
{
1414
Schema::table('users', function (Blueprint $table) {
15-
$table->text('two_factor_secret')
16-
->after('password')
17-
->nullable();
18-
19-
$table->text('two_factor_recovery_codes')
20-
->after('two_factor_secret')
21-
->nullable();
22-
23-
$table->timestamp('two_factor_confirmed_at')
24-
->after('two_factor_recovery_codes')
25-
->nullable();
15+
$table->text('two_factor_secret')->after('password')->nullable();
16+
$table->text('two_factor_recovery_codes')->after('two_factor_secret')->nullable();
17+
$table->timestamp('two_factor_confirmed_at')->after('two_factor_recovery_codes')->nullable();
2618
});
2719
}
2820

resources/js/components/TwoFactorSetupModal.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const pinInputContainerRef = ref<HTMLElement | null>(null);
3030
const modalConfig = computed<{ title: string; description: string; buttonText: string }>(() => {
3131
if (props.twoFactorEnabled) {
3232
return {
33-
title: 'You have enabled two factor authentication.',
34-
description: 'Two factor authentication is now enabled, scan the QR code or enter the setup key in authenticator app.',
33+
title: 'Two-Factor Authentication Enabled',
34+
description: 'Two-factor authentication is now enabled. Scan the QR code or enter the setup key in your authenticator app.',
3535
buttonText: 'Close',
3636
};
3737
}
@@ -45,8 +45,8 @@ const modalConfig = computed<{ title: string; description: string; buttonText: s
4545
}
4646
4747
return {
48-
title: 'Turn on 2-step Verification',
49-
description: 'To finish enabling two factor authentication, scan the QR code or enter the setup key in authenticator app',
48+
title: 'Enable Two-Factor Authentication',
49+
description: 'To finish enabling two-factor authentication, scan the QR code or enter the setup key in your authenticator app',
5050
buttonText: 'Continue',
5151
};
5252
});

resources/js/pages/auth/TwoFactorChallenge.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const codeValue = computed<string>(() => code.value.join(''));
4444

4545
<template>
4646
<AuthLayout :title="authConfigContent.title" :description="authConfigContent.description">
47-
<Head title="Two Factor Authentication" />
47+
<Head title="Two-Factor Authentication" />
4848

4949
<div class="space-y-6">
5050
<template v-if="!showRecoveryInput">

resources/js/pages/settings/TwoFactor.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ onUnmounted(() => {
4747

4848
<div v-if="!twoFactorEnabled" class="flex flex-col items-start justify-start space-y-4">
4949
<Badge variant="destructive">Disabled</Badge>
50+
5051
<p class="text-muted-foreground">
51-
When you enable 2FA, you'll be prompted for a secure code during login, which can be retrieved from your phone's TOTP
52-
supported app.
52+
When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can
53+
be retrieved from a TOTP-supported application on your phone.
5354
</p>
5455

5556
<div>
@@ -62,9 +63,10 @@ onUnmounted(() => {
6263

6364
<div v-else class="flex flex-col items-start justify-start space-y-4">
6465
<Badge variant="default">Enabled</Badge>
66+
6567
<p class="text-muted-foreground">
66-
With two factor authentication enabled, you'll be prompted for a secure, random token during login, which you can retrieve
67-
from your TOTP Authenticator app.
68+
With two-factor authentication enabled, you will be prompted for a secure, random pin during login, which you
69+
can retrieve from the TOTP-supported application on your phone.
6870
</p>
6971

7072
<TwoFactorRecoveryCodes />

tests/Feature/Auth/AuthenticationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function test_users_can_authenticate_using_the_login_screen()
3434
public function test_users_with_two_factor_enabled_are_redirected_to_two_factor_challenge()
3535
{
3636
if (! Features::canManageTwoFactorAuthentication()) {
37-
$this->markTestSkipped('Two factor authentication is not enabled.');
37+
$this->markTestSkipped('Two-factor authentication is not enabled.');
3838
}
3939

4040
Features::twoFactorAuthentication([

tests/Feature/Auth/PasswordConfirmationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function test_confirm_password_screen_can_be_rendered()
2626
public function test_password_confirmation_requires_authentication()
2727
{
2828
$response = $this->get(route('password.confirm'));
29+
2930
$response->assertRedirect(route('login'));
3031
}
3132
}

0 commit comments

Comments
 (0)