diff --git a/lib/Froxlor/Api/Commands/IpsAndPorts.php b/lib/Froxlor/Api/Commands/IpsAndPorts.php index ffb6600b..0c2138e6 100644 --- a/lib/Froxlor/Api/Commands/IpsAndPorts.php +++ b/lib/Froxlor/Api/Commands/IpsAndPorts.php @@ -176,8 +176,9 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity if ((int)Settings::Get('system.use_ssl') == 1) { $ssl = (bool)$this->getBoolParam('ssl', true, 0); - $ssl_cert_file = Validate::validate($this->getParam('ssl_cert_file', !$ssl, ''), 'ssl_cert_file', '', '', [], true); - $ssl_key_file = Validate::validate($this->getParam('ssl_key_file', !$ssl, ''), 'ssl_key_file', '', '', [], true); + $cert_optional = !($ssl && empty(Settings::Get('system.ssl_cert_file'))); + $ssl_cert_file = Validate::validate($this->getParam('ssl_cert_file', $cert_optional, ''), 'ssl_cert_file', '', '', [], true); + $ssl_key_file = Validate::validate($this->getParam('ssl_key_file', $cert_optional, ''), 'ssl_key_file', '', '', [], true); $ssl_ca_file = Validate::validate($this->getParam('ssl_ca_file', true, ''), 'ssl_ca_file', '', '', [], true); $ssl_cert_chainfile = Validate::validate($this->getParam('ssl_cert_chainfile', true, ''), 'ssl_cert_chainfile', '', '', [], true); $sslss = $this->getParam('ssl_specialsettings', true, ''); @@ -415,8 +416,9 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity if ((int)Settings::Get('system.use_ssl') == 1) { $ssl = (bool)$this->getBoolParam('ssl', true, $result['ssl']); - $ssl_cert_file = Validate::validate($this->getParam('ssl_cert_file', !$ssl, $result['ssl_cert_file']), 'ssl_cert_file', '', '', [], true); - $ssl_key_file = Validate::validate($this->getParam('ssl_key_file', !$ssl, $result['ssl_key_file']), 'ssl_key_file', '', '', [], true); + $cert_optional = !($ssl && empty(Settings::Get('system.ssl_cert_file'))); + $ssl_cert_file = Validate::validate($this->getParam('ssl_cert_file', $cert_optional, $result['ssl_cert_file']), 'ssl_cert_file', '', '', [], true); + $ssl_key_file = Validate::validate($this->getParam('ssl_key_file', $cert_optional, $result['ssl_key_file']), 'ssl_key_file', '', '', [], true); $ssl_ca_file = Validate::validate($this->getParam('ssl_ca_file', true, $result['ssl_ca_file']), 'ssl_ca_file', '', '', [], true); $ssl_cert_chainfile = Validate::validate($this->getParam('ssl_cert_chainfile', true, $result['ssl_cert_chainfile']), 'ssl_cert_chainfile', '', '', [], true); $sslss = $this->getParam('ssl_specialsettings', true, $result['ssl_specialsettings']); diff --git a/lib/formfields/formfield.domain_ssleditor.php b/lib/formfields/formfield.domain_ssleditor.php index ee71cdad..cf0f784f 100644 --- a/lib/formfields/formfield.domain_ssleditor.php +++ b/lib/formfields/formfield.domain_ssleditor.php @@ -44,7 +44,8 @@ return [ 'cols' => 100, 'rows' => 15, 'value' => $result['ssl_cert_file'], - 'placeholder' => lng('domain.ssl_certificate_placeholder') + 'placeholder' => lng('domain.ssl_certificate_placeholder'), + 'mandatory' => true ], 'ssl_key_file' => [ 'label' => lng('admin.ipsandports.ssl_key_file_content'), @@ -53,7 +54,8 @@ return [ 'cols' => 100, 'rows' => 15, 'value' => $result['ssl_key_file'], - 'placeholder' => lng('domain.ssl_key_placeholder') + 'placeholder' => lng('domain.ssl_key_placeholder'), + 'mandatory' => true ], 'ssl_cert_chainfile' => [ 'label' => lng('admin.ipsandports.ssl_cert_chainfile_content'),