From ac5d67d55750d0bc959f1dad019d4686de7d0531 Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Wed, 30 Oct 2024 11:07:05 +0100 Subject: [PATCH] fix: force fortify config when package is registered to support filament panels on root path --- src/TwoFactorAuthServiceProvider.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/TwoFactorAuthServiceProvider.php b/src/TwoFactorAuthServiceProvider.php index c09ed5f..54e5f4a 100644 --- a/src/TwoFactorAuthServiceProvider.php +++ b/src/TwoFactorAuthServiceProvider.php @@ -115,7 +115,10 @@ public function configurePackage(Package $package): void } } - public function packageRegistered(): void {} + public function packageRegistered(): void + { + $this->forceFortifyConfig(); + } public function packageBooted(): void { @@ -145,8 +148,6 @@ public function packageBooted(): void // Testing Testable::mixin(new TestsTwoFactorAuth); - $this->forceFortifyConfig(); - $this->registerContractsAndComponents(); $this->defineRateLimiters(); @@ -170,7 +171,7 @@ public function packageBooted(): void * This route name is used multiple places in filament. */ Route::prefix(config('filament.path'))->group(function () { - Route::get('/filament-login', fn () => Redirect::route('login')) + Route::get('/filament-login', fn() => Redirect::route('login')) ->name('auth.login'); }); }); @@ -180,6 +181,7 @@ protected function forceFortifyConfig(): void { config([ 'filament.auth.pages.login' => config('filament-2fa.login'), + 'fortify.prefix' => 'fortify', 'fortify.views' => true, 'fortify.home' => config('filament.home_url'), 'forms.dark_mode' => config('filament.dark_mode'),