security/acme-client: hide custom CA URL field when not required, refs #2529

This commit is contained in:
Frank Wall
2021-10-07 01:01:17 +02:00
parent 3c5efa5545
commit 35ae215ebe
3 changed files with 17 additions and 2 deletions
@@ -33,9 +33,14 @@
<type>dropdown</type>
<help><![CDATA[The ACME CA that should be used for this account and all associated certificates. Note that some of them offer paid services and may require a subscription. Check the <a href="https://github.com/acmesh-official/acme.sh/wiki/Server" target="_blank">acme.sh documentation</a> for a list of supported CAs.]]></help>
</field>
<field>
<label>CA Options</label>
<type>header</type>
<style>ca_options ca_options_custom</style>
</field>
<field>
<id>account.custom_ca</id>
<label>Custom ACME CA URL</label>
<label>Custom CA URL</label>
<type>text</type>
<help><![CDATA[The HTTPS URL of the custom ACME CA that should be used for this account and all associated certificates. If using your own CA, make sure the Root CA is added to OPNsense's trust store. For example: https://acme-v02.api.letsencrypt.org/directory or https://ca.internal/acme/directory]]></help>
</field>
@@ -152,7 +152,7 @@
<custom_ca type="TextField">
<Required>N</Required>
<mask>/^https?:\/\/.*[^\/]$/</mask>
<ValidationMessage>The url must be a valid ACME endpoint without a trailing slash.</ValidationMessage>
<ValidationMessage>The URL must be a valid ACME endpoint without a trailing slash.</ValidationMessage>
</custom_ca>
<eab_kid type="TextField">
<Required>N</Required>
@@ -317,6 +317,16 @@ POSSIBILITY OF SUCH DAMAGE.
});
// hook into on-show event for dialog to extend layout.
$('#DialogAccount').on('shown.bs.modal', function (e) {
// hide options that are irrelevant for the selected CA
$("#account\\.ca").change(function(){
$(".ca_options").hide();
$(".ca_options_"+$(this).val()).show();
});
$("#account\\.ca").change();
})
});
</script>