app->singleton( \Laravel\Fortify\Actions\DisableTwoFactorAuthentication::class, DisableTwoFactorAuthentication::class, ); } /** * Bootstrap any application services. */ public function boot(): void { Fortify::createUsersUsing(CreateNewUser::class); RateLimiter::for('login', fn (Request $request) => Limit::perMinute(5)->by($request->input('username') . $request->ip())); RateLimiter::for('two-factor', fn (Request $request) => Limit::perMinute(5)->by($request->session()->get('login.id'))); Fortify::loginView(fn () => view('auth.login', [ 'articles' => WebsiteArticle::with(['user:id,username,look']) ->whereHas('user') ->latest('id') ->take(4) ->get(), 'photos' => CameraWeb::query() ->latest('id') ->take(4) ->with('user:id,username,look') ->get(), ])); Fortify::registerView(function (Request $request) { if (setting('disable_registration') === '1') { return to_route('welcome')->withErrors([ 'register' => __('Registration is currently disabled.'), ]); } return view('auth.register', [ 'referral_code' => $request->route('referral_code'), 'articles' => WebsiteArticle::with(['user:id,username,look']) ->whereHas('user') ->latest('id') ->take(4) ->get(), 'photos' => CameraWeb::query() ->latest('id') ->take(2) ->with('user:id,username,look') ->get(), ]); }); Fortify::confirmPasswordView(fn () => view('auth.passwords.confirm')); Fortify::twoFactorChallengeView(fn () => view('auth.two-factor-challenge')); $this->authenticate(); } private function authenticate(): void { Fortify::authenticateThrough(fn () => array_filter([ config('fortify.limiters.login') ? null : EnsureLoginIsNotThrottled::class, Features::enabled(Features::twoFactorAuthentication()) ? RedirectIfTwoFactorConfirmed::class : null, AttemptToAuthenticate::class, PrepareAuthenticatedSession::class, ])); } }