diff --git a/app/Extensions/Fortify/CustomTwoFactorLoginResponse.php b/app/Extensions/Fortify/CustomTwoFactorLoginResponse.php new file mode 100644 index 00000000..9f3ae6a3 --- /dev/null +++ b/app/Extensions/Fortify/CustomTwoFactorLoginResponse.php @@ -0,0 +1,28 @@ +pull('url.intended', route('dashboard', [], false)); + + return $request->wantsJson() + ? new JsonResponse('', 204) + : Inertia::location($redirectPath); + } +} diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index 4dbe82d4..1eaabb34 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -9,6 +9,7 @@ use App\Actions\Fortify\ResetUserPassword; use App\Actions\Fortify\UpdateUserPassword; use App\Actions\Fortify\UpdateUserProfileInformation; use App\Extensions\Fortify\CustomLoginResponse; +use App\Extensions\Fortify\CustomTwoFactorLoginResponse; use App\Models\User; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Http\Request; @@ -16,6 +17,7 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; +use Laravel\Fortify\Contracts\TwoFactorLoginResponse; use Laravel\Fortify\Fortify; use Laravel\Fortify\Http\Responses\LoginResponse; @@ -64,5 +66,6 @@ class FortifyServiceProvider extends ServiceProvider }); $this->app->instance(LoginResponse::class, new CustomLoginResponse()); + $this->app->instance(TwoFactorLoginResponse::class, new CustomTwoFactorLoginResponse()); } } diff --git a/config/app.php b/config/app.php index d05bf660..d3e3d449 100644 --- a/config/app.php +++ b/config/app.php @@ -18,7 +18,7 @@ return [ | */ - 'name' => env('APP_NAME', 'Laravel'), + 'name' => env('APP_NAME', 'solidtime'), /* |--------------------------------------------------------------------------