diff --git a/app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php b/app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php index 495bbfca75b..d7e45a7ceba 100644 --- a/app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php +++ b/app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php @@ -16,8 +16,6 @@ class RedirectIfTwoFactorAuthenticatable { /** * Create a new action instance. - * - * @return void */ public function __construct( protected StatefulGuard $guard, @@ -27,10 +25,8 @@ public function __construct( /** * Handle the incoming request. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { $user = $this->validateCredentials($request); @@ -59,7 +55,6 @@ protected function validateCredentials(Request $request): ?User /** * Throw a failed authentication validation exception. * - * * @throws \Illuminate\Validation\ValidationException */ protected function throwFailedAuthenticationException(Request $request): void @@ -91,7 +86,7 @@ protected function twoFactorChallengeResponse(Request $request, ?User $user) { $request->session()->put([ 'login.id' => $user->getKey(), - 'login.remember' => $request->filled('remember'), + 'login.remember' => $request->boolean('remember'), ]); TwoFactorAuthenticationChallenged::dispatch($user); diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index e21cd0bc4c5..f48783deef0 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -3,7 +3,6 @@ namespace App\Providers; use App\Actions\Fortify\CreateNewUser; -use App\Actions\Fortify\RedirectIfTwoFactorAuthenticatable; use App\Actions\Fortify\ResetUserPassword; use App\Actions\Fortify\TwoFactorChallengeView; use App\Actions\Fortify\UpdateUserPassword; @@ -14,8 +13,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\ServiceProvider; -use Laravel\Fortify\Actions\AttemptToAuthenticate; -use Laravel\Fortify\Actions\PrepareAuthenticatedSession; use Laravel\Fortify\Fortify; class FortifyServiceProvider extends ServiceProvider @@ -37,12 +34,6 @@ public function register() */ public function boot() { - Fortify::authenticateThrough(fn () => [ - RedirectIfTwoFactorAuthenticatable::class, - AttemptToAuthenticate::class, - PrepareAuthenticatedSession::class, - ]); - Fortify::loginView(fn ($request) => (new LoginController())($request)); Fortify::confirmPasswordsUsing(fn ($user, ?string $password = null) => $user->password ? app(StatefulGuard::class)->validate([ diff --git a/composer.json b/composer.json index 56b6ae8ca4f..9fb2ff75a19 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": "^8.2", "ext-fileinfo": "*", "asbiin/laravel-sentry-tunnel": "^2.0", - "asbiin/laravel-webauthn": "^4.0", + "asbiin/laravel-webauthn": "^4.4", "codezero/laravel-localizer": "^3.0", "doctrine/dbal": "^3.6", "guzzlehttp/guzzle": "^7.4", diff --git a/composer.lock b/composer.lock index c94094c9dcc..b57b1d51263 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a7bb5c9c0b8cd67afde0d64334647da1", + "content-hash": "f68048c67692666099fda98e1c1e2d82", "packages": [ { "name": "asbiin/laravel-sentry-tunnel", @@ -82,16 +82,16 @@ }, { "name": "asbiin/laravel-webauthn", - "version": "4.4.0", + "version": "4.4.1", "source": { "type": "git", "url": "https://github.com/asbiin/laravel-webauthn.git", - "reference": "3e5eaa22f51161e41eb66643675df72e3ba5f884" + "reference": "a47afc4bf20e9fd63749f08d6fa877748fe49faf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asbiin/laravel-webauthn/zipball/3e5eaa22f51161e41eb66643675df72e3ba5f884", - "reference": "3e5eaa22f51161e41eb66643675df72e3ba5f884", + "url": "https://api.github.com/repos/asbiin/laravel-webauthn/zipball/a47afc4bf20e9fd63749f08d6fa877748fe49faf", + "reference": "a47afc4bf20e9fd63749f08d6fa877748fe49faf", "shasum": "" }, "require": { @@ -180,7 +180,7 @@ "type": "github" } ], - "time": "2024-04-03T15:01:42+00:00" + "time": "2024-04-08T20:50:21+00:00" }, { "name": "bacon/bacon-qr-code", diff --git a/config/fortify.php b/config/fortify.php index 1a7611db7fc..c7d61d0f12a 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -142,4 +142,11 @@ ]), ], + 'pipelines' => [ + 'login' => [ + \App\Actions\Fortify\RedirectIfTwoFactorAuthenticatable::class, + \Laravel\Fortify\Actions\AttemptToAuthenticate::class, + \Laravel\Fortify\Actions\PrepareAuthenticatedSession::class, + ], + ], ];