Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion resources/js/pages/errors/404.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<script setup>
import { Card, Heading, Description } from '@ui';
import { Card, Heading, Description, Button } from '@ui';
import Blank from '@/pages/layout/Blank.vue';
import useBodyClasses from '@/pages/layout/body-classes.js';

defineOptions({ layout: Blank });
useBodyClasses('bg-gray-50 dark:bg-gray-900');
</script>

<template>
<div class="flex min-h-screen flex-col items-center justify-center">
<Card class="text-center flex flex-col items-center space-y-2">
<Heading size="2xl" :text="__('404')" />
<Description :text="__('The page you are looking for could not be found.')" />
<Button as="a" :href="cp_url('/')" size="xs" variant="filled" class="mt-4" :text="__('Return to Control Panel')" />
</Card>
</div>
</template>
3 changes: 2 additions & 1 deletion resources/js/pages/errors/Error.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { Card, Heading, Description } from '@ui';
import { Card, Heading, Description, Button } from '@ui';
import Blank from '@/pages/layout/Blank.vue';
import useBodyClasses from '@/pages/layout/body-classes.js';

Expand All @@ -13,6 +13,7 @@ useBodyClasses('bg-gray-50 dark:bg-gray-900');
<Card class="text-center flex flex-col items-center space-y-2">
<Heading size="2xl" :text="__('Whoops!')" />
<Description :text="`${__('Something went wrong')} (${status})`" />
<Button as="a" :href="cp_url('/')" size="xs" variant="filled" class="mt-4" :text="__('Return to Control Panel')" />
</Card>
</div>
</template>
6 changes: 6 additions & 0 deletions src/Exceptions/Concerns/RendersHttpExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Inertia\Inertia;
use Statamic\Exceptions\AuthenticationException;
use Statamic\Facades\Cascade;
use Statamic\Facades\User;
use Statamic\Statamic;
use Statamic\StaticCaching\Cacher;
use Statamic\StaticCaching\Cachers\ApplicationCacher;
Expand All @@ -23,6 +25,10 @@ public function render(Request $request)
}

if (Statamic::isCpRoute()) {
if (! User::current()) {
return (new AuthenticationException)->toResponse($request);
}

return Inertia::render('errors/'.$this->getStatusCode())
->toResponse(request())
->setStatusCode($this->getStatusCode());
Expand Down
4 changes: 4 additions & 0 deletions tests/Routing/RouteBindingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public function binds_route_parameters_in_statamic_routes(
) {
$this->setupContent();

$this->actingAs(tap(Facades\User::make()->makeSuper())->save());

$response = $this->get($uri);

if ($expectationCallback) {
Expand All @@ -148,6 +150,8 @@ public function binds_route_parameters_in_statamic_routes_with_bindings_disabled
) {
$this->setupContent();

$this->actingAs(tap(Facades\User::make()->makeSuper())->save());

$response = $this->get($uri);

if ($expectationCallback) {
Expand Down
Loading