summaryrefslogtreecommitdiffstats
path: root/modules/webinterface.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-12-05 19:15:41 +0100
committerSimon Rettberg2014-12-05 19:15:41 +0100
commit19ec20ab89bf938fe2dd1a99b62debc76e199425 (patch)
treefb084493aed19cc481b2276dff5063ac796c7a65 /modules/webinterface.inc.php
parentUse different icons for client log entries (incomplete) (diff)
downloadslx-admin-19ec20ab89bf938fe2dd1a99b62debc76e199425.tar.gz
slx-admin-19ec20ab89bf938fe2dd1a99b62debc76e199425.tar.xz
slx-admin-19ec20ab89bf938fe2dd1a99b62debc76e199425.zip
Add option to hide or show password fields
Diffstat (limited to 'modules/webinterface.inc.php')
-rw-r--r--modules/webinterface.inc.php85
1 files changed, 85 insertions, 0 deletions
diff --git a/modules/webinterface.inc.php b/modules/webinterface.inc.php
new file mode 100644
index 00000000..fcaf923b
--- /dev/null
+++ b/modules/webinterface.inc.php
@@ -0,0 +1,85 @@
+<?php
+
+class Page_WebInterface extends Page
+{
+
+ protected function doPreprocess()
+ {
+ User::load();
+ if (!User::hasPermission('superadmin')) {
+ Message::addError('no-permission');
+ Util::redirect('?do=Main');
+ }
+ switch (Request::post('action')) {
+ case 'https':
+ $this->actionConfigureHttps();
+ break;
+ case 'password':
+ $this->actionShowHidePassword();
+ break;
+ }
+ }
+
+ private function actionConfigureHttps()
+ {
+ $task = false;
+ switch (Request::post('mode')) {
+ case 'off':
+ $task = $this->setHttpsOff();
+ break;
+ case 'random':
+ $task = $this->setHttpsRandomCert();
+ break;
+ case 'custom':
+ $task = $this->setHttpsCustomCert();
+ break;
+ }
+ if (isset($task['id'])) {
+ Session::set('https-id', $task['id']);
+ Util::redirect('?do=WebInterface&show=httpsupdate');
+ }
+ }
+
+ private function actionShowHidePassword()
+ {
+ Property::setPasswordFieldType(Request::post('mode') === 'show' ? 'text' : 'password');
+ Util::redirect('?do=WebInterface');
+ }
+
+ protected function doRender()
+ {
+ Render::setTitle(Dictionary::translate('title-webinterface'));
+ if (Request::get('show') === 'httpsupdate') {
+ Render::addTemplate('webinterface/httpd-restart', array('taskid' => Session::get('https-id')));
+ }
+ Render::addTemplate('webinterface/https');
+ $data = array();
+ if (Property::getPasswordFieldType() === 'text')
+ $data['selected_show'] = 'checked';
+ else
+ $data['selected_hide'] = 'checked';
+ Render::addTemplate('webinterface/passwords', $data);
+ }
+
+ private function setHttpsOff()
+ {
+ return Taskmanager::submit('LighttpdHttps', array());
+ }
+
+ private function setHttpsRandomCert()
+ {
+ return Taskmanager::submit('LighttpdHttps', array(
+ 'proxyip' => Property::getServerIp()
+ ));
+ }
+
+ private function setHttpsCustomCert()
+ {
+ return Taskmanager::submit('LighttpdHttps', array(
+ 'importcert' => Request::post('certificate', 'bla'),
+ 'importkey' => Request::post('privatekey', 'bla'),
+ 'importchain' => Request::post('cachain', '')
+ ));
+ }
+
+}