From a37beef18e8875f7608891ce00c122b12e6b04db Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 6 Oct 2022 14:23:56 +0200 Subject: [PATCH] fix shell-select for customer ftp-accounts if shell is enabled; fix typo in UserCommand Signed-off-by: Michael Kaufmann --- customer_ftp.php | 14 ++++++++++---- lib/Froxlor/Cli/UserCommand.php | 2 +- lib/formfields/customer/ftp/formfield.ftp_add.php | 2 +- lib/formfields/customer/ftp/formfield.ftp_edit.php | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/customer_ftp.php b/customer_ftp.php index 6ebaa789..8aeaaa69 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -133,8 +133,11 @@ if ($page == 'overview' || $page == 'accounts') { $shells['/bin/false'] = "/bin/false"; $shells_avail = Settings::Get('system.available_shells'); if (!empty($shells_avail)) { - $shells_avail = explode(",", $shells_avail); - $shells_avail = array_map("trim", $shells_avail); + $shells_avail_arr = explode(",", $shells_avail); + $shells_avail_arr = array_map("trim", $shells_avail_arr); + foreach ($shells_avail_arr as $shell) { + $shells[$shell] = $shell; + } } } @@ -180,8 +183,11 @@ if ($page == 'overview' || $page == 'accounts') { $shells['/bin/false'] = "/bin/false"; $shells_avail = Settings::Get('system.available_shells'); if (!empty($shells_avail)) { - $shells_avail = explode(",", $shells_avail); - $shells_avail = array_map("trim", $shells_avail); + $shells_avail_arr = explode(",", $shells_avail); + $shells_avail_arr = array_map("trim", $shells_avail_arr); + foreach ($shells_avail_arr as $shell) { + $shells[$shell] = $shell; + } } } diff --git a/lib/Froxlor/Cli/UserCommand.php b/lib/Froxlor/Cli/UserCommand.php index 33caef39..1a7674b0 100644 --- a/lib/Froxlor/Cli/UserCommand.php +++ b/lib/Froxlor/Cli/UserCommand.php @@ -45,7 +45,7 @@ final class UserCommand extends CliCommand $this->setDescription('Various user actions'); $this->addArgument('user', InputArgument::REQUIRED, 'Loginname of the target user') ->addArgument('admin', InputArgument::OPTIONAL, 'Loginname of the executing admin/reseller user', 'admin'); - $this->addOption('unlock', 'u', InputOption::VALUE_NONE, 'Unock user after too many failed login attempts') + $this->addOption('unlock', 'u', InputOption::VALUE_NONE, 'Unlock user after too many failed login attempts') ->addOption('change-passwd', 'p', InputOption::VALUE_NONE, 'Set new password for given user') ->addOption('show-info', 's', InputOption::VALUE_NONE, 'Output information details of given user'); } diff --git a/lib/formfields/customer/ftp/formfield.ftp_add.php b/lib/formfields/customer/ftp/formfield.ftp_add.php index 01d4702d..6ae68494 100644 --- a/lib/formfields/customer/ftp/formfield.ftp_add.php +++ b/lib/formfields/customer/ftp/formfield.ftp_add.php @@ -76,7 +76,7 @@ return [ 'visible' => Settings::Get('system.allow_customer_shell') == '1', 'label' => lng('panel.shell'), 'type' => 'select', - 'select_var' => $shells_avail, + 'select_var' => $shells, 'selected' => '/bin/false' ] ] diff --git a/lib/formfields/customer/ftp/formfield.ftp_edit.php b/lib/formfields/customer/ftp/formfield.ftp_edit.php index 776a904a..73bc101b 100644 --- a/lib/formfields/customer/ftp/formfield.ftp_edit.php +++ b/lib/formfields/customer/ftp/formfield.ftp_edit.php @@ -61,7 +61,7 @@ return [ 'visible' => Settings::Get('system.allow_customer_shell') == '1', 'label' => lng('panel.shell'), 'type' => 'select', - 'select_var' => $shells_avail, + 'select_var' => $shells, 'selected' => $result['shell'] ?? '/bin/false' ] ]