Skip to content

Commit

Permalink
[5.x] Fix unauthorized page logout redirect (#10378)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
bensherred and jasonvarga authored Jul 1, 2024
1 parent 3c5111e commit cfbe3eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/auth/unauthorized.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="outside-shadow absolute inset-0"></div>
<div class="card auth-card">
<div class="mb-6">{{ __('Unauthorized') }}</div>
<a class="btn-primary" href="{{ cp_route('logout') }}?redirect={{ cp_route('login') }}">{{ __('Log out') }}</a>
<a class="btn-primary" href="{{ cp_route('logout') }}?redirect={{ $redirect }}">{{ __('Log out') }}</a>
</div>
</div>

Expand Down
6 changes: 5 additions & 1 deletion src/Http/Controllers/CP/Auth/UnauthorizedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class UnauthorizedController
{
public function __invoke()
{
return view('statamic::auth.unauthorized');
$redirect = config('statamic.cp.auth.enabled', true)
? cp_route('login')
: config('statamic.cp.auth.redirect_to', '/');

return view('statamic::auth.unauthorized', compact('redirect'));
}
}

0 comments on commit cfbe3eb

Please sign in to comment.