From 75181a3f4302008d18dee9120109cc15ca1871b3 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Fri, 22 Nov 2024 14:18:54 +0000 Subject: [PATCH] [6.x] fix auth redirects (#387) --- src/Http/Responses/OAuthLoginResponse.php | 3 +-- src/Http/Responses/OAuthRegisterResponse.php | 3 +-- src/Socialstream.php | 5 ++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Http/Responses/OAuthLoginResponse.php b/src/Http/Responses/OAuthLoginResponse.php index f761d24..68d2696 100644 --- a/src/Http/Responses/OAuthLoginResponse.php +++ b/src/Http/Responses/OAuthLoginResponse.php @@ -24,7 +24,6 @@ public function toResponse($request): RedirectResponse|FortifyLoginResponse config('socialstream.filament-route', 'filament.admin.pages.dashboard') ), $this->hasComposerPackage('laravel/jetstream') => $this->fortifyResponse($request), - $this->hasComposerPackage('laravel/breeze') => redirect()->route('dashboard'), default => $this->defaultResponse(), }; } @@ -40,6 +39,6 @@ private function defaultResponse(): RedirectResponse { return Socialstream::redirects('login') ? redirect()->intended(Socialstream::redirects('login')) - : redirect()->to(route('dashboard', absolute: false)); + : redirect()->to(config('socialstream.home')); } } diff --git a/src/Http/Responses/OAuthRegisterResponse.php b/src/Http/Responses/OAuthRegisterResponse.php index 61a4878..52ec0b5 100644 --- a/src/Http/Responses/OAuthRegisterResponse.php +++ b/src/Http/Responses/OAuthRegisterResponse.php @@ -25,7 +25,6 @@ public function toResponse($request): RedirectResponse|RegisterResponse config('socialstream.filament-route', 'filament.admin.pages.dashboard') ), $this->hasComposerPackage('laravel/jetstream') => $this->fortifyResponse($request), - $this->hasComposerPackage('laravel/breeze') => redirect()->route('dashboard'), default => $this->defaultResponse(), }; } @@ -41,6 +40,6 @@ private function defaultResponse(): RedirectResponse { return Socialstream::redirects('register') ? redirect()->intended(Socialstream::redirects('register')) - : redirect()->to(route('dashboard', absolute: false)); + : redirect()->to(config('socialstream.home')); } } diff --git a/src/Socialstream.php b/src/Socialstream.php index aff0ca6..b215175 100644 --- a/src/Socialstream.php +++ b/src/Socialstream.php @@ -122,7 +122,10 @@ public static function providers(): array */ public static function redirects(string $redirect, mixed $default = null) { - return config('socialstream.redirects.'.$redirect) ?? $default ?? config('socialstream.home'); + return config( + key: "socialstream.redirects.$redirect", + default: $default ?? config('socialstream.home') + ); } /**