diff --git a/resources/views/auth/unauthorized.blade.php b/resources/views/auth/unauthorized.blade.php index 3fb6ecafae..3502faa78b 100644 --- a/resources/views/auth/unauthorized.blade.php +++ b/resources/views/auth/unauthorized.blade.php @@ -10,7 +10,7 @@
diff --git a/src/Http/Controllers/CP/Auth/UnauthorizedController.php b/src/Http/Controllers/CP/Auth/UnauthorizedController.php index dd0d427599..260742e10b 100644 --- a/src/Http/Controllers/CP/Auth/UnauthorizedController.php +++ b/src/Http/Controllers/CP/Auth/UnauthorizedController.php @@ -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')); } }