diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-10-18 12:20:21 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-10-18 12:20:21 +0200 |
commit | a0329557f6ea2d7edb04a4ad768302e4e57b5c77 (patch) | |
tree | e1406409fb281ec4766f0de48a8a9320d0d19aa2 /apps/settings/lib/Controller/CheckSetupController.php | |
parent | 80893480c1e95796ed5154e0cad166aa76e1bc24 (diff) | |
download | nextcloud-server-feat/settings/too-much-caching-setup-check.tar.gz nextcloud-server-feat/settings/too-much-caching-setup-check.zip |
feat(settings): Add setup check for too much cachingfeat/settings/too-much-caching-setup-check
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/settings/lib/Controller/CheckSetupController.php')
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 5dcf6cda29c..c2e397c502e 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -74,6 +74,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\RedirectResponse; use OCP\DB\Events\AddMissingColumnsEvent; use OCP\DB\Events\AddMissingIndicesEvent; @@ -94,6 +95,8 @@ use OCP\Notification\IManager; use OCP\Security\Bruteforce\IThrottler; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; +use function setcookie; +use function time; #[IgnoreOpenAPI] class CheckSetupController extends Controller { @@ -972,4 +975,19 @@ Raw output ] ); } + + /** + * @AuthorizedAdminSetting(settings=OCA\Settings\Settings\Admin\Overview) + */ + public function checkCookies(): JSONResponse { + $rand = $this->secureRandom->generate(32); + setcookie( + 'nc_setup_check', + $rand, + time() + 60 + ); + return new JSONResponse([ + 'rand' => $rand, + ]); + } } |