Add all the settings stuff
This commit is contained in:
parent
e63f309c89
commit
66d1df4bc5
@ -5,20 +5,22 @@
|
||||
<name>External Password</name>
|
||||
<summary>An app for Nextcloud to allow an administrator to direct a user to an external site for changing their password.</summary>
|
||||
<description><![CDATA[An app for Nextcloud to allow an administrator to direct a user to an external site for changing their password. This is useful in conjunction with an app like external_users.]]></description>
|
||||
<version>0.0.1</version>
|
||||
<version>0.1.0</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="raoul@snyman.info" >Raoul Snyman</author>
|
||||
<namespace>ExternalPassword</namespace>
|
||||
<category>customization</category>
|
||||
<category>security</category>
|
||||
<website>https://git.snyman.info/raoul/externalpassword</website>
|
||||
<repository>https://git.snyman.info/raoul/externalpassword</repository>
|
||||
<bugs>https://git.snyman.info/raoul/externalpassword/issues</bugs>
|
||||
<dependencies>
|
||||
<nextcloud min-version="15" max-version="15"/>
|
||||
<nextcloud min-version="22"/>
|
||||
</dependencies>
|
||||
<navigations>
|
||||
<navigation>
|
||||
<name>External Password</name>
|
||||
<route>externalpassword.page.index</route>
|
||||
</navigation>
|
||||
</navigations>
|
||||
<settings>
|
||||
<admin>OCA\ExternalPassword\Settings\Admin</admin>
|
||||
<admin-section>OCA\ExternalPassword\Settings\AdminSection</admin-section>
|
||||
<personal>OCA\ExternalPassword\Settings\Personal</personal>
|
||||
<personal-section>OCA\ExternalPassword\Settings\PersonalSection</personal-section>
|
||||
</settings>
|
||||
</info>
|
||||
|
@ -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'],
|
||||
]
|
||||
];
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
namespace OCA\ExternalPassword\Controller;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
class PageController extends Controller {
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName, IRequest $request, $UserId){
|
||||
parent::__construct($AppName, $request);
|
||||
$this->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
|
||||
}
|
||||
|
||||
}
|
34
lib/Controller/SettingsController.php
Normal file
34
lib/Controller/SettingsController.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace OCA\ExternalPassword\Controller;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\IConfig;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
class SettingsController extends Controller {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct($AppName, IRequest $request, IConfig $config) {
|
||||
parent::__construct($AppName, $request);
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user