Skip to content

Commit

Permalink
redirect guest user to the login page of current panel
Browse files Browse the repository at this point in the history
redirect guest user to the login page of current panel, or default panel if current panel could not be detected
  • Loading branch information
imami authored Aug 19, 2024
1 parent 0c6c7aa commit a388b15
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Http/Livewire/LockerScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ class LockerScreen extends BasePage
public function mount()
{
// Check if the request is still authenticated or not before rendering the page,
// if not authenticated then redirect to the default filament login page
// if not authenticated then redirect to the login page of current panel, or default panel if current panel could not be detected.

if(!Filament::auth()->check())
if (!Filament::auth()->check())
{
return redirect(Filament::getDefaultPanel()->getLoginUrl());
if (filament()->getCurrentPanel()) {
return redirect(filament()->getCurrentPanel()->getLoginUrl());
}

return redirect(filament()->getDefaultPanel()->getLoginUrl());
}

session(['lockscreen' => true]);
Expand Down

0 comments on commit a388b15

Please sign in to comment.