summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/addmodule_sshconfig.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/sysconfig/addmodule_sshconfig.inc.php')
-rw-r--r--modules-available/sysconfig/addmodule_sshconfig.inc.php42
1 files changed, 25 insertions, 17 deletions
diff --git a/modules-available/sysconfig/addmodule_sshconfig.inc.php b/modules-available/sysconfig/addmodule_sshconfig.inc.php
index ec01f878..2447f9be 100644
--- a/modules-available/sysconfig/addmodule_sshconfig.inc.php
+++ b/modules-available/sysconfig/addmodule_sshconfig.inc.php
@@ -9,14 +9,18 @@ class SshConfig_Start extends AddModule_Base
protected function renderInternal()
{
- if ($this->edit !== false) {
- $data = $this->edit->getData(false) + array(
+ if ($this->edit !== null) {
+ $data = $this->edit->getData(null) + array(
'title' => $this->edit->title(),
'edit' => $this->edit->id(),
- 'apl' => $this->edit->getData('allowPasswordLogin') === 'yes'
+ 'PWD_' . strtoupper($this->edit->getData('allowPasswordLogin')) . '_selected' => 'selected',
+ 'USR_' . strtoupper($this->edit->getData('allowedUsersLogin')) . '_selected' => 'selected',
);
} else {
- $data = array();
+ $data = array(
+ 'PWD_NO_selected' => 'selected',
+ 'USR_ROOT_ONLY_selected' => 'selected',
+ );
}
Render::addDialog(Dictionary::translateFile('config-module', 'sshconfig_title'), false, 'sshconfig-start', $data + array(
'step' => 'SshConfig_Finish',
@@ -36,15 +40,17 @@ class SshConfig_Finish extends AddModule_Base
return;
}
// Seems ok, create entry
- if ($this->edit === false)
+ if ($this->edit === null) {
$module = ConfigModule::getInstance('SshConfig');
- else
+ } else {
$module = $this->edit;
+ }
if ($module === false) {
Message::addError('main.error-read', 'sshconfig.inc.php');
Util::redirect('?do=SysConfig&action=addmodule&step=SshConfig_Start');
}
- $module->setData('allowPasswordLogin', Request::post('allowPasswordLogin') === 'yes');
+ $module->setData('allowPasswordLogin', Request::post('allowPasswordLogin'));
+ $module->setData('allowedUsersLogin', Request::post('allowedUsersLogin'));
$port = Request::post('listenPort', '');
if ($port === '') {
$port = 22;
@@ -53,23 +59,25 @@ class SshConfig_Finish extends AddModule_Base
Message::addError('main.value-invalid', 'port', Request::post('listenPort'));
Util::redirect('?do=SysConfig&action=addmodule&step=SshConfig_Start');
}
- if (!$module->setData('publicKey', Request::post('publicKey'))) {
- Message::addError('main.value-invalid', 'pubkey', Request::post('publicKey'));
- Util::redirect('?do=SysConfig&action=addmodule&step=SshConfig_Start');
- }
- if ($this->edit !== false)
+ $module->setData('publicKey', false);
+ if ($this->edit !== null) {
$ret = $module->update($title);
- else
+ } else {
$ret = $module->insert($title);
- if (!$ret)
+ }
+ if (!$ret) {
Util::redirect('?do=SysConfig&action=addmodule&step=SshConfig_Start');
- elseif (!$module->generate($this->edit === false, NULL, 200))
+ } elseif (!$module->generate($this->edit === null, NULL, 200)) {
Util::redirect('?do=SysConfig&action=addmodule&step=SshConfig_Start');
+ }
// Yay
- if ($this->edit !== false)
+ if ($this->edit !== null) {
Message::addSuccess('module-edited');
- else
+ } else {
Message::addSuccess('module-added');
+ AddModule_Base::setStep('AddModule_Assign', $module->id());
+ return;
+ }
Util::redirect('?do=SysConfig');
}