Skip to content

Commit ef476b0

Browse files
committed
refactor FortifyServiceProvider.php
1 parent f3ee5b5 commit ef476b0

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

app/Providers/FortifyServiceProvider.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,57 @@ public function register(): void
2727
* Bootstrap any application services.
2828
*/
2929
public function boot(): void
30+
{
31+
$this->configureActions();
32+
$this->configureViews();
33+
$this->configureRateLimiting();
34+
}
35+
36+
/**
37+
* Configure Fortify actions.
38+
*/
39+
protected function configureActions(): void
3040
{
3141
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
3242
Fortify::createUsersUsing(CreateNewUser::class);
43+
}
3344

45+
/**
46+
* Configure Fortify views.
47+
*/
48+
protected function configureViews(): void
49+
{
3450
Fortify::loginView(fn (Request $request) => Inertia::render('auth/Login', [
3551
'canResetPassword' => Features::enabled(Features::resetPasswords()),
3652
'canRegister' => Features::enabled(Features::registration()),
3753
'status' => $request->session()->get('status'),
3854
]));
3955

40-
Fortify::registerView(fn () => Inertia::render('auth/Register'));
41-
42-
Fortify::requestPasswordResetLinkView(fn (Request $request) => Inertia::render('auth/ForgotPassword', [
43-
'status' => $request->session()->get('status'),
44-
]));
45-
4656
Fortify::resetPasswordView(fn (Request $request) => Inertia::render('auth/ResetPassword', [
4757
'email' => $request->email,
4858
'token' => $request->route('token'),
4959
]));
5060

61+
Fortify::requestPasswordResetLinkView(fn (Request $request) => Inertia::render('auth/ForgotPassword', [
62+
'status' => $request->session()->get('status'),
63+
]));
64+
5165
Fortify::verifyEmailView(fn (Request $request) => Inertia::render('auth/VerifyEmail', [
5266
'status' => $request->session()->get('status'),
5367
]));
5468

69+
Fortify::registerView(fn () => Inertia::render('auth/Register'));
70+
5571
Fortify::twoFactorChallengeView(fn () => Inertia::render('auth/TwoFactorChallenge'));
5672

5773
Fortify::confirmPasswordView(fn () => Inertia::render('auth/ConfirmPassword'));
74+
}
5875

76+
/**
77+
* Configure rate limiting for authentication.
78+
*/
79+
protected function configureRateLimiting(): void
80+
{
5981
RateLimiter::for('two-factor', function (Request $request) {
6082
return Limit::perMinute(5)->by($request->session()->get('login.id'));
6183
});

0 commit comments

Comments
 (0)