allow to remove user/pass from quick_shell configuration

This commit is contained in:
fbsanchez 2019-11-12 13:19:03 +01:00
parent dc565d2575
commit 1a7165f751
1 changed files with 78 additions and 55 deletions

View File

@ -298,70 +298,86 @@ function quickShellSettings()
ui_require_css_file('wizard'); ui_require_css_file('wizard');
ui_require_css_file('discovery'); ui_require_css_file('discovery');
// Parser.
// Gotty settings. Internal communication (WS). // Gotty settings. Internal communication (WS).
$gotty = get_parameter( if (isset($config['gotty_host']) === false) {
'gotty', config_update_value('gotty_host', '127.0.0.1');
$config['gotty']
);
$gotty_host = get_parameter(
'gotty_host',
$config['gotty_host']
);
$gotty_ssh_port = get_parameter(
'gotty_ssh_port',
$config['gotty_ssh_port']
);
$gotty_telnet_port = get_parameter(
'gotty_telnet_port',
$config['gotty_telnet_port']
);
$gotty_user = get_parameter(
'gotty_user',
$config['gotty_user']
);
$gotty_pass = get_parameter(
'gotty_pass',
io_output_password($config['gotty_pass'])
);
$gotty_pass = io_input_password($gotty_pass);
$changes = 0;
$critical = 0;
if ($config['gotty'] != $gotty) {
config_update_value('gotty', $gotty);
$changes++;
$critical++;
} }
if ($config['gotty_host'] != $gotty_host) { if (isset($config['gotty_telnet_port']) === false) {
config_update_value('gotty_host', $gotty_host); config_update_value('gotty_telnet_port', 8082);
$changes++;
} }
if ($config['gotty_telnet_port'] != $gotty_telnet_port) { if (isset($config['gotty_ssh_port']) === false) {
config_update_value('gotty_telnet_port', $gotty_telnet_port); config_update_value('gotty_ssh_port', 8081);
$changes++;
} }
if ($config['gotty_ssh_port'] != $gotty_ssh_port) { // Parser.
config_update_value('gotty_ssh_port', $gotty_ssh_port); if (get_parameter('qs_update', false) !== false) {
$changes++; // Gotty settings. Internal communication (WS).
} $gotty = get_parameter(
'gotty',
''
);
$gotty_host = get_parameter(
'gotty_host',
$config['gotty_host']
);
$gotty_ssh_port = get_parameter(
'gotty_ssh_port',
$config['gotty_ssh_port']
);
$gotty_telnet_port = get_parameter(
'gotty_telnet_port',
$config['gotty_telnet_port']
);
if ($config['gotty_user'] != $gotty_user) { $gotty_user = get_parameter(
config_update_value('gotty_user', $gotty_user); 'gotty_user',
$changes++; ''
$critical++; );
}
if ($config['gotty_pass'] != $gotty_pass) { $gotty_pass = get_parameter(
config_update_value('gotty_pass', $gotty_pass); 'gotty_pass',
$changes++; ''
$critical++; );
$gotty_pass = io_input_password($gotty_pass);
$changes = 0;
$critical = 0;
if ($config['gotty'] != $gotty) {
config_update_value('gotty', $gotty);
$changes++;
$critical++;
}
if ($config['gotty_host'] != $gotty_host) {
config_update_value('gotty_host', $gotty_host);
$changes++;
}
if ($config['gotty_telnet_port'] != $gotty_telnet_port) {
config_update_value('gotty_telnet_port', $gotty_telnet_port);
$changes++;
}
if ($config['gotty_ssh_port'] != $gotty_ssh_port) {
config_update_value('gotty_ssh_port', $gotty_ssh_port);
$changes++;
}
if ($config['gotty_user'] != $gotty_user) {
config_update_value('gotty_user', $gotty_user);
$changes++;
$critical++;
}
if ($config['gotty_pass'] != $gotty_pass) {
$gotty_pass = io_input_password($gotty_pass);
config_update_value('gotty_pass', $gotty_pass);
$changes++;
$critical++;
}
} }
// Interface. // Interface.
@ -447,6 +463,13 @@ function quickShellSettings()
'value' => io_output_password($config['gotty_pass']), 'value' => io_output_password($config['gotty_pass']),
], ],
], ],
[
'arguments' => [
'type' => 'hidden',
'name' => 'qs_update',
'value' => 1,
],
],
[ [
'arguments' => [ 'arguments' => [
'type' => 'submit', 'type' => 'submit',