Skip to content
Merged
14 changes: 8 additions & 6 deletions administrator/components/com_config/forms/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
label="COM_CONFIG_FIELD_DATABASE_HOST_LABEL"
required="true"
filter="string"
onchange="Joomla.resetDbEncryptionFields(this)"
size="30"
/>

Expand Down Expand Up @@ -237,6 +238,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_ENABLE_LABEL"
default="0"
filter="integer"
showon="host!:localhost"
>
<option value="0">COM_CONFIG_FIELD_DATABASE_ENCRYPTION_ENABLE_VALUE_NONE</option>
<option value="1">COM_CONFIG_FIELD_DATABASE_ENCRYPTION_ENABLE_VALUE_ONE_WAY</option>
Expand All @@ -250,7 +252,7 @@
class="switcher"
default="0"
filter="boolean"
showon="dbencryption:1,2"
showon="host!:localhost[AND]dbencryption:1,2"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
Expand All @@ -262,7 +264,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_KEY_LABEL"
filter="string"
size="250"
showon="dbencryption:2"
showon="host!:localhost[AND]dbencryption:2"
/>

<field
Expand All @@ -271,7 +273,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CERT_LABEL"
filter="string"
size="250"
showon="dbencryption:2"
showon="host!:localhost[AND]dbencryption:2"
/>

<field
Expand All @@ -280,7 +282,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CA_LABEL"
filter="string"
size="250"
showon="dbencryption:2"
showon="host!:localhost[AND]dbencryption:2"
/>

<field
Expand All @@ -289,7 +291,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CAPATH_LABEL"
filter="string"
size="250"
showon="dbtype:mysql,mysqli[AND]dbencryption:2"
showon="host!:localhost[AND]dbtype:mysql,mysqli[AND]dbencryption:2"
/>

<field
Expand All @@ -298,7 +300,7 @@
label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CIPHER_LABEL"
filter="string"
size="300"
showon="dbtype:mysql,mysqli[AND]dbencryption:2"
showon="host!:localhost[AND]dbtype:mysql,mysqli[AND]dbencryption:2"
/>

</fieldset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');

// Load config JS
HTMLHelper::_('script', 'com_config/admin-config-default.js', ['version' => 'auto', 'relative' => true]);

// Load JS message titles
Text::script('ERROR');
Text::script('WARNING');
Expand Down
25 changes: 25 additions & 0 deletions build/media_source/com_config/js/admin-config-default.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Joomla = window.Joomla || {};

((Joomla) => {
'use strict';

/**
* Method reset DB Encryption fields when localhost is chosen
*
* @param {HTMLElement} element The element that initiates the call
* @returns {void}
* @since 4.0
*/
Joomla.resetDbEncryptionFields = (element) => {
if (element.value === 'localhost') {
document.getElementById('jform_dbsslverifyservercert0').checked = true;
document.getElementById('jform_dbsslverifyservercert1').checked = false;
document.getElementById('jform_dbsslkey').value = '';
document.getElementById('jform_dbsslcert').value = '';
document.getElementById('jform_dbsslca').value = '';
document.getElementById('jform_dbsslcapath').value = '';
document.getElementById('jform_dbsslcipher').value = '';
document.getElementById('jform_dbencryption').value = 0;
}
};
})(Joomla);