Skip to content

Commit

Permalink
Fix redirect to correct panel by saving panel ID in the session
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Aug 19, 2024
1 parent cde2e87 commit efc1503
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Http/Livewire/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ protected function getFormSchema(): array

public function loginWithFortify()
{
session()->put('panel', Filament::getCurrentPanel()->getId());

try {
$this->rateLimit(5);
} catch (TooManyRequestsException $exception) {
Expand Down
6 changes: 5 additions & 1 deletion src/Http/Responses/TwoFactorLoginResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class TwoFactorLoginResponse implements LoginResponseContract
*/
public function toResponse($request)
{
return redirect()->intended(Filament::getCurrentPanel()->getUrl());
$panel = Filament::getPanel(session()->get('panel'));

session()->forget('panel');

return redirect()->intended($panel->getUrl());
}
}

0 comments on commit efc1503

Please sign in to comment.