From 66d1df4bc5131831a8c9b226de1f524cc1dc6996 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 11 May 2022 17:26:12 -0700 Subject: [PATCH] Add all the settings stuff --- appinfo/info.xml | 18 +++++++------- appinfo/routes.php | 3 +-- lib/Controller/PageController.php | 31 ------------------------ lib/Controller/SettingsController.php | 34 +++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 41 deletions(-) delete mode 100644 lib/Controller/PageController.php create mode 100644 lib/Controller/SettingsController.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 46dc881..fb92f28 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,20 +5,22 @@ External Password An app for Nextcloud to allow an administrator to direct a user to an external site for changing their password. - 0.0.1 + 0.1.0 agpl Raoul Snyman ExternalPassword customization security + https://git.snyman.info/raoul/externalpassword + https://git.snyman.info/raoul/externalpassword https://git.snyman.info/raoul/externalpassword/issues - + - - - External Password - externalpassword.page.index - - + + OCA\ExternalPassword\Settings\Admin + OCA\ExternalPassword\Settings\AdminSection + OCA\ExternalPassword\Settings\Personal + OCA\ExternalPassword\Settings\PersonalSection + diff --git a/appinfo/routes.php b/appinfo/routes.php index c041a3c..2edef29 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -9,7 +9,6 @@ */ return [ 'routes' => [ - ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], - ['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'], + ['name' => 'Settings#save', 'url' => '/settings/admin/security/externalpassword', 'verb' => 'POST'], ] ]; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php deleted file mode 100644 index 8e15b1b..0000000 --- a/lib/Controller/PageController.php +++ /dev/null @@ -1,31 +0,0 @@ -userId = $UserId; - } - - /** - * CAUTION: the @Stuff turns off security checks; for this page no admin is - * required and no CSRF check. If you don't know what CSRF is, read - * it up in the docs or you might create a security hole. This is - * basically the only required method to add this exemption, don't - * add it to any other method if you don't exactly know what it does - * - * @NoAdminRequired - * @NoCSRFRequired - */ - public function index() { - return new TemplateResponse('externalpassword', 'index'); // templates/index.php - } - -} diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php new file mode 100644 index 0000000..0c8ca8c --- /dev/null +++ b/lib/Controller/SettingsController.php @@ -0,0 +1,34 @@ +config = $config; + } + + /** + * @param string + */ + public function save(string $changePasswordUrl, string $descriptionText, string $buttonText): JSONResponse { + $this->config->setAppValue('externalpassword', 'changePasswordUrl', $changePasswordUrl); + $this->config->setAppValue('externalpassword', 'descriptionText', $descriptionText); + $this->config->setAppValue('externalpassword', 'buttonText', $buttonText); + $parameters = [ + 'changePasswordUrl' => $changePasswordUrl, + 'descriptionText' => $descriptionText, + 'buttonText' => $buttonText + ]; + return new JSONResponse($parameters); + } + +}