From d3e6063027c0416fd5bd308c6cf62547de15cfc6 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 31 Oct 2023 14:55:02 +0100 Subject: [PATCH] more password-suggestion fields modernized as the others; little beautifications here and there Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cron/Http/Apache.php | 19 +++---------------- lib/Froxlor/Cron/Http/HttpConfigBase.php | 9 +++++++++ lib/Froxlor/Cron/Http/Nginx.php | 9 +-------- .../extras/formfield.htpasswd_add.php | 17 ++++++++++------- .../extras/formfield.htpasswd_edit.php | 17 ++++++++++------- .../customer/mysql/formfield.mysql_add.php | 18 ++++++++++-------- .../customer/mysql/formfield.mysql_edit.php | 18 ++++++++++-------- templates/misc/deactivated/index.html | 2 +- 8 files changed, 54 insertions(+), 55 deletions(-) diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index 7a99b49d..a7f2147b 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -515,13 +515,7 @@ class Apache extends HttpConfigBase */ private function createStandardDirectoryEntry() { - $vhosts_folder = ''; - if (is_dir(Settings::Get('system.apacheconf_vhost'))) { - $vhosts_folder = FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost')); - } else { - $vhosts_folder = FileDir::makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost'))); - } - $vhosts_filename = FileDir::makeCorrectFile($vhosts_folder . '/05_froxlor_dirfix_nofcgid.conf'); + $vhosts_filename = $this->getCustomVhostFilename('05_froxlor_dirfix_nofcgid.conf'); if (!isset($this->virtualhosts_data[$vhosts_filename])) { $this->virtualhosts_data[$vhosts_filename] = ''; @@ -545,7 +539,7 @@ class Apache extends HttpConfigBase } $this->virtualhosts_data[$vhosts_filename] .= ' ' . "\n"; - $ocsp_cache_filename = FileDir::makeCorrectFile($vhosts_folder . '/03_froxlor_ocsp_cache.conf'); + $ocsp_cache_filename = $this->getCustomVhostFilename('03_froxlor_ocsp_cache.conf'); if (Settings::Get('system.use_ssl') == '1' && Settings::Get('system.apache24') == 1) { $this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' . Settings::Get('system.apache24_ocsp_cache_path') . "\n"; } else { @@ -562,14 +556,7 @@ class Apache extends HttpConfigBase private function createStandardErrorHandler() { if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && (Settings::Get('defaultwebsrverrhandler.err401') != '' || Settings::Get('defaultwebsrverrhandler.err403') != '' || Settings::Get('defaultwebsrverrhandler.err404') != '' || Settings::Get('defaultwebsrverrhandler.err500') != '')) { - $vhosts_folder = ''; - if (is_dir(Settings::Get('system.apacheconf_vhost'))) { - $vhosts_folder = FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost')); - } else { - $vhosts_folder = FileDir::makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost'))); - } - - $vhosts_filename = FileDir::makeCorrectFile($vhosts_folder . '/05_froxlor_default_errorhandler.conf'); + $vhosts_filename = $this->getCustomVhostFilename('05_froxlor_default_errorhandler.conf'); if (!isset($this->virtualhosts_data[$vhosts_filename])) { $this->virtualhosts_data[$vhosts_filename] = ''; diff --git a/lib/Froxlor/Cron/Http/HttpConfigBase.php b/lib/Froxlor/Cron/Http/HttpConfigBase.php index 4226322a..712f625e 100644 --- a/lib/Froxlor/Cron/Http/HttpConfigBase.php +++ b/lib/Froxlor/Cron/Http/HttpConfigBase.php @@ -202,4 +202,13 @@ class HttpConfigBase } return FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $filename); } + + protected function getCustomVhostFilename(string $name) + { + $vhosts_folder = FileDir::makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost'))); + if (is_dir(Settings::Get('system.apacheconf_vhost'))) { + $vhosts_folder = FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost')); + } + return FileDir::makeCorrectFile($vhosts_folder . '/' . $name); + } } diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index b9a345f2..08d88254 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -1161,14 +1161,7 @@ class Nginx extends HttpConfigBase private function createStandardErrorHandler() { if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && (Settings::Get('defaultwebsrverrhandler.err401') != '' || Settings::Get('defaultwebsrverrhandler.err403') != '' || Settings::Get('defaultwebsrverrhandler.err404') != '' || Settings::Get('defaultwebsrverrhandler.err500') != '')) { - $vhosts_folder = ''; - if (is_dir(Settings::Get('system.apacheconf_vhost'))) { - $vhosts_folder = FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost')); - } else { - $vhosts_folder = FileDir::makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost'))); - } - - $vhosts_filename = FileDir::makeCorrectFile($vhosts_folder . '/05_froxlor_default_errorhandler.conf'); + $vhosts_filename = $this->getCustomVhostFilename('05_froxlor_default_errorhandler.conf'); if (!isset($this->nginx_data[$vhosts_filename])) { $this->nginx_data[$vhosts_filename] = ''; diff --git a/lib/formfields/customer/extras/formfield.htpasswd_add.php b/lib/formfields/customer/extras/formfield.htpasswd_add.php index 6277cdcb..98241c37 100644 --- a/lib/formfields/customer/extras/formfield.htpasswd_add.php +++ b/lib/formfields/customer/extras/formfield.htpasswd_add.php @@ -55,13 +55,16 @@ return [ 'label' => lng('login.password'), 'type' => 'password', 'autocomplete' => 'off', - 'mandatory' => true - ], - 'directory_password_suggestion' => [ - 'label' => lng('customer.generated_pwd'), - 'type' => 'text', - 'visible' => (Settings::Get('panel.password_regex') == ''), - 'value' => Crypt::generatePassword() + 'mandatory' => true, + 'next_to' => [ + 'directory_password_suggestion' => [ + 'next_to_prefix' => lng('customer.generated_pwd') . ':', + 'type' => 'text', + 'visible' => (Settings::Get('panel.password_regex') == ''), + 'value' => Crypt::generatePassword(), + 'readonly' => true + ] + ] ], 'directory_authname' => [ 'label' => lng('extras.htpasswdauthname'), diff --git a/lib/formfields/customer/extras/formfield.htpasswd_edit.php b/lib/formfields/customer/extras/formfield.htpasswd_edit.php index da339d40..88a55948 100644 --- a/lib/formfields/customer/extras/formfield.htpasswd_edit.php +++ b/lib/formfields/customer/extras/formfield.htpasswd_edit.php @@ -49,13 +49,16 @@ return [ 'directory_password' => [ 'label' => lng('login.password'), 'type' => 'password', - 'autocomplete' => 'off' - ], - 'directory_password_suggestion' => [ - 'label' => lng('customer.generated_pwd'), - 'type' => 'text', - 'visible' => (Settings::Get('panel.password_regex') == ''), - 'value' => Crypt::generatePassword() + 'autocomplete' => 'off', + 'next_to' => [ + 'directory_password_suggestion' => [ + 'next_to_prefix' => lng('customer.generated_pwd') . ':', + 'type' => 'text', + 'visible' => (Settings::Get('panel.password_regex') == ''), + 'value' => Crypt::generatePassword(), + 'readonly' => true + ] + ] ], 'directory_authname' => [ 'label' => lng('extras.htpasswdauthname'), diff --git a/lib/formfields/customer/mysql/formfield.mysql_add.php b/lib/formfields/customer/mysql/formfield.mysql_add.php index 9fbe706a..da0ceded 100644 --- a/lib/formfields/customer/mysql/formfield.mysql_add.php +++ b/lib/formfields/customer/mysql/formfield.mysql_add.php @@ -46,14 +46,16 @@ return [ 'label' => lng('login.password'), 'type' => 'password', 'autocomplete' => 'off', - 'mandatory' => true - ], - 'mysql_password_suggestion' => [ - 'label' => lng('customer.generated_pwd'), - 'type' => 'text', - 'visible' => (Settings::Get('panel.password_regex') == ''), - 'value' => Crypt::generatePassword(), - 'readonly' => true + 'mandatory' => true, + 'next_to' => [ + 'mysql_password_suggestion' => [ + 'next_to_prefix' => lng('customer.generated_pwd') . ':', + 'type' => 'text', + 'visible' => (Settings::Get('panel.password_regex') == ''), + 'value' => Crypt::generatePassword(), + 'readonly' => true + ] + ] ], 'sendinfomail' => [ 'label' => lng('customer.sendinfomail'), diff --git a/lib/formfields/customer/mysql/formfield.mysql_edit.php b/lib/formfields/customer/mysql/formfield.mysql_edit.php index 80d00207..1c9d3021 100644 --- a/lib/formfields/customer/mysql/formfield.mysql_edit.php +++ b/lib/formfields/customer/mysql/formfield.mysql_edit.php @@ -52,14 +52,16 @@ return [ 'mysql_password' => [ 'label' => lng('changepassword.new_password_ifnotempty'), 'type' => 'password', - 'autocomplete' => 'off' - ], - 'mysql_password_suggestion' => [ - 'label' => lng('customer.generated_pwd'), - 'type' => 'text', - 'visible' => (Settings::Get('panel.password_regex') == ''), - 'value' => Crypt::generatePassword(), - 'readonly' => true + 'autocomplete' => 'off', + 'next_to' => [ + 'mysql_password_suggestion' => [ + 'next_to_prefix' => lng('customer.generated_pwd') . ':', + 'type' => 'text', + 'visible' => (Settings::Get('panel.password_regex') == ''), + 'value' => Crypt::generatePassword(), + 'readonly' => true + ] + ] ] ] ] diff --git a/templates/misc/deactivated/index.html b/templates/misc/deactivated/index.html index a07df96f..0510004f 100644 --- a/templates/misc/deactivated/index.html +++ b/templates/misc/deactivated/index.html @@ -41,7 +41,7 @@ - Please ask your provider/hoster if you think this is not correct + Please ask your provider/hoster if you have any questions.