diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-10 11:37:06 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-10 11:37:06 -0500 |
commit | a4ba0282e6cba7916e3955f2d44da9a902f80587 (patch) | |
tree | 0d72ed31459d4cc807ac2e8ec6795b2a74f45657 /src/usr | |
parent | 4e322e2c189e18133324c933ad35f0735fab510f (diff) | |
download | pfsense-a4ba0282e6cba7916e3955f2d44da9a902f80587.zip pfsense-a4ba0282e6cba7916e3955f2d44da9a902f80587.tar.gz |
Fixed #5602 by dynamically updating hte help text based on the cert selected.
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/vpn_openvpn_client.php | 4 | ||||
-rw-r--r-- | src/usr/local/www/vpn_openvpn_server.php | 24 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/usr/local/www/vpn_openvpn_client.php b/src/usr/local/www/vpn_openvpn_client.php index 496f6e0..19a9609 100644 --- a/src/usr/local/www/vpn_openvpn_client.php +++ b/src/usr/local/www/vpn_openvpn_client.php @@ -616,11 +616,13 @@ if($act=="new" || $act=="edit") : $pconfig['shared_key'] ))->setHelp('Paste your shared key here'); + $cl = openvpn_build_cert_list(true); + $section->addInput(new Form_Select( 'certref', 'Client Certificate', $pconfig['certref'], - openvpn_build_cert_list(true) + $cl['server'] )); $section->addInput(new Form_Select( diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php index 746eac6..4a475b4 100644 --- a/src/usr/local/www/vpn_openvpn_server.php +++ b/src/usr/local/www/vpn_openvpn_server.php @@ -747,24 +747,29 @@ if($act=="new" || $act=="edit") : )); } - $certhelp = ""; + $certhelp = '<span id="certtype"></span>'; if (count($a_cert)) { if (!empty(trim($pconfig['certref']))) { $thiscert = lookup_cert($pconfig['certref']); $purpose = cert_get_purpose($thiscert['crt'], true); if ($purpose['server'] != "Yes") { - $certhelp = gettext("Warning: The previously saved server was not created as an SSL Server certificate and may not work properly."); + $certhelp = '<span id="certtype" class="text-danger">' . gettext("Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected") . ' </span>'; } } } else { - $certhelp = sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'); + $certhelp = sprintf('%s%s%s$s', '<span id="certtype">', gettext('No Certificates defined. You may create one here: '), '<a href="system_camanager.php">System > Cert Manager</a>', '</span>'); } + $cl = openvpn_build_cert_list(false, true); + + //Save the number of server certs for use at run-time + $servercerts = count($cl['server']); + $section->addInput(new Form_Select( 'certref', 'Server certificate', $pconfig['certref'], - openvpn_build_cert_list(false, true) + $cl['server'] + $cl['non-server'] ))->setHelp($certhelp); $section->addInput(new Form_Select( @@ -1569,6 +1574,17 @@ events.push(function(){ tuntap_change(); }); + // Certref + $('#certref').on('change', function() { + var errmsg = ""; + + if ($(this).find(":selected").index() >= "<?=$servercerts?>") { + var errmsg = '<span class="text-danger">' + "<?=gettext('Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected')?>" + '</span>'; + } + + $('#certtype').html(errmsg); + }); + // ---------- Set initial page display state ---------------------------------------------------------------------- mode_change(); autokey_change(); |