Skip to content

Commit

Permalink
[6.x] fix auth redirects (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher authored Nov 22, 2024
1 parent 4471801 commit 75181a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Http/Responses/OAuthLoginResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
}
Expand All @@ -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'));
}
}
3 changes: 1 addition & 2 deletions src/Http/Responses/OAuthRegisterResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
}
Expand All @@ -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'));
}
}
5 changes: 4 additions & 1 deletion src/Socialstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
}

/**
Expand Down

0 comments on commit 75181a3

Please sign in to comment.