2022-10-14 01:42:25 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-27 04:08:53 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2022-10-14 01:42:25 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OC\Core\Controller;
|
|
|
|
|
|
2025-05-14 09:51:42 -04:00
|
|
|
use OCP\AppFramework\Controller;
|
2022-10-14 01:42:25 -04:00
|
|
|
use OCP\AppFramework\Http;
|
2024-01-10 06:35:44 -05:00
|
|
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
2024-07-25 07:24:59 -04:00
|
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
2024-01-18 04:38:37 -05:00
|
|
|
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
2024-07-25 07:24:59 -04:00
|
|
|
use OCP\AppFramework\Http\Attribute\PublicPage;
|
2022-10-14 01:42:25 -04:00
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
|
|
|
|
2024-01-18 04:38:37 -05:00
|
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
2025-05-14 09:51:42 -04:00
|
|
|
class ErrorController extends Controller {
|
2024-07-25 07:24:59 -04:00
|
|
|
#[PublicPage]
|
|
|
|
|
#[NoCSRFRequired]
|
2024-01-10 06:35:44 -05:00
|
|
|
#[FrontpageRoute(verb: 'GET', url: 'error/403')]
|
2022-10-14 01:42:25 -04:00
|
|
|
public function error403(): TemplateResponse {
|
|
|
|
|
$response = new TemplateResponse(
|
|
|
|
|
'core',
|
|
|
|
|
'403',
|
|
|
|
|
[],
|
|
|
|
|
'error'
|
|
|
|
|
);
|
|
|
|
|
$response->setStatus(Http::STATUS_FORBIDDEN);
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-25 07:24:59 -04:00
|
|
|
#[PublicPage]
|
|
|
|
|
#[NoCSRFRequired]
|
2024-01-10 06:35:44 -05:00
|
|
|
#[FrontpageRoute(verb: 'GET', url: 'error/404')]
|
2022-10-14 01:42:25 -04:00
|
|
|
public function error404(): TemplateResponse {
|
|
|
|
|
$response = new TemplateResponse(
|
|
|
|
|
'core',
|
|
|
|
|
'404',
|
|
|
|
|
[],
|
|
|
|
|
'error'
|
|
|
|
|
);
|
|
|
|
|
$response->setStatus(Http::STATUS_NOT_FOUND);
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
}
|