From 11608d553297115579f297437c2b24dba13b67af Mon Sep 17 00:00:00 2001 From: Cima Alfa <119798452+cima-alfa@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:11:16 +0200 Subject: [PATCH 1/3] Fix unnamed routes when views are disabled --- routes/routes.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/routes/routes.php b/routes/routes.php index 6bc8e18..c74d9bd 100644 --- a/routes/routes.php +++ b/routes/routes.php @@ -35,12 +35,19 @@ $twoFactorLimiter = config('fortify.limiters.two-factor'); $verificationLimiter = config('fortify.limiters.verification', '6,1'); - Route::post(RoutePath::for('login', '/login'), [AuthenticatedSessionController::class, 'store']) + $login = Route::post( + RoutePath::for('login', '/login'), + [AuthenticatedSessionController::class, 'store'] + ) ->middleware(array_filter([ 'guest:'.config('fortify.guard'), $limiter ? 'throttle:'.$limiter : null, ])); + if (! $enableViews) { + $login->name('login'); + } + Route::post(RoutePath::for('logout', '/logout'), [AuthenticatedSessionController::class, 'destroy']) ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]) ->name('logout'); @@ -74,8 +81,15 @@ ->name('register'); } - Route::post(RoutePath::for('register', '/register'), [RegisteredUserController::class, 'store']) + $register = Route::post( + RoutePath::for('register', '/register'), + [RegisteredUserController::class, 'store'] + ) ->middleware(['guest:'.config('fortify.guard')]); + + if (! $enableViews) { + $register->name('register'); + } } // Email Verification... @@ -131,12 +145,18 @@ ->name('two-factor.login'); } - Route::post(RoutePath::for('two-factor.login', '/two-factor-challenge'), [TwoFactorAuthenticatedSessionController::class, 'store']) + $twoFactorLogin = Route::post( + RoutePath::for('two-factor.login', '/two-factor-challenge'), [TwoFactorAuthenticatedSessionController::class, 'store'] + ) ->middleware(array_filter([ 'guest:'.config('fortify.guard'), $twoFactorLimiter ? 'throttle:'.$twoFactorLimiter : null, ])); + if (! $enableViews) { + $twoFactorLogin->name('two-factor.login'); + } + $twoFactorMiddleware = Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword') ? [config('fortify.auth_middleware', 'auth').':'.config('fortify.guard'), 'password.confirm'] : [config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]; From b7bc7e25937575db02863b2b06ceeff9309b781a Mon Sep 17 00:00:00 2001 From: Cima Alfa <119798452+cima-alfa@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:20:03 +0200 Subject: [PATCH 2/3] Fix unnamed routed when views are disabled --- routes/routes.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/routes/routes.php b/routes/routes.php index c74d9bd..536b168 100644 --- a/routes/routes.php +++ b/routes/routes.php @@ -126,16 +126,23 @@ // Password Confirmation... if ($enableViews) { Route::get(RoutePath::for('password.confirm', '/user/confirm-password'), [ConfirmablePasswordController::class, 'show']) - ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]); + ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]) + ->name('password.confirm'); } Route::get(RoutePath::for('password.confirmation', '/user/confirmed-password-status'), [ConfirmedPasswordStatusController::class, 'show']) ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]) ->name('password.confirmation'); - Route::post(RoutePath::for('password.confirm', '/user/confirm-password'), [ConfirmablePasswordController::class, 'store']) - ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]) - ->name('password.confirm'); + $passwordConfirm = Route::post( + RoutePath::for('password.confirm', '/user/confirm-password'), + [ConfirmablePasswordController::class, 'store'] + ) + ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]); + + if (! $enableViews) { + $passwordConfirm->name('password.confirm'); + } // Two Factor Authentication... if (Features::enabled(Features::twoFactorAuthentication())) { From 8ce9f7c9b56c75c6a53bc9a71b77159258599fe3 Mon Sep 17 00:00:00 2001 From: Cima Alfa <119798452+cima-alfa@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:27:29 +0200 Subject: [PATCH 3/3] Run pint --- routes/routes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/routes.php b/routes/routes.php index 536b168..2343ea3 100644 --- a/routes/routes.php +++ b/routes/routes.php @@ -138,7 +138,7 @@ RoutePath::for('password.confirm', '/user/confirm-password'), [ConfirmablePasswordController::class, 'store'] ) - ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]); + ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]); if (! $enableViews) { $passwordConfirm->name('password.confirm');