diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-09-21 09:59:29 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-09-21 09:59:29 -0400 |
commit | 705ba8d55f3679bc9fca03e8c623ea592fc0420e (patch) | |
tree | 9c99010200998e52f7d7dda9867c2335fd0c9cb1 /src/usr/local/www/vpn_openvpn_server.php | |
parent | c5199c04b7cdad949fecc42700c687cf05b55c8a (diff) | |
download | pfsense-705ba8d55f3679bc9fca03e8c623ea592fc0420e.zip pfsense-705ba8d55f3679bc9fca03e8c623ea592fc0420e.tar.gz |
Fixed #5175
Diffstat (limited to 'src/usr/local/www/vpn_openvpn_server.php')
-rw-r--r-- | src/usr/local/www/vpn_openvpn_server.php | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php index b402088..f3ea12c 100644 --- a/src/usr/local/www/vpn_openvpn_server.php +++ b/src/usr/local/www/vpn_openvpn_server.php @@ -742,6 +742,27 @@ if($act=="new" || $act=="edit") : build_mode_list() )); + $options = array(); + $authmodes = array(); + + $authmodes = explode(",", $pconfig['authmode']); + $auth_servers = auth_get_authserver_list(); + // If no authmodes set then default to selecting the first entry in auth_servers + if (empty($authmodes[0]) && !empty(key($auth_servers))) { + $authmodes[0] = key($auth_servers); + } + + foreach ($auth_servers as $auth_server_key => $auth_server) + $options[$auth_server_key] = $auth_server['name']; + + $section->addInput(new Form_Select( + 'authmode', + 'Backend for authentication', + $authmodes, + $options, + true + ))->addClass('authmode'); + $section->addInput(new Form_Select( 'protocol', 'Protocol', @@ -1372,7 +1393,7 @@ events.push(function(){ hideCheckbox('gwredir', true); hideInput('local_network', true); hideInput('local_networkv6', true); - hideInput('authmode', true); + hideMultiClass('authmode', true); hideCheckbox('client2client', true); break; case "p2p_tls": @@ -1382,7 +1403,7 @@ events.push(function(){ hideCheckbox('gwredir', false); hideInput('local_network', false); hideInput('local_networkv6', false); - hideInput('authmode', true); + hideMultiClass('authmode', true); hideCheckbox('client2client', true); break; case "server_user": @@ -1393,11 +1414,11 @@ events.push(function(){ hideCheckbox('gwredir', false); hideInput('local_network', false); hideInput('local_networkv6', false); - hideInput('authmode', false); + hideMultiClass('authmode', false); hideCheckbox('client2client', false); break; case "server_tls": - hideInput('authmode', true); + hideMultiClass('authmode', true); default: hideInput('custom_options', false); hideInput('verbosity_level', false); @@ -1411,38 +1432,28 @@ events.push(function(){ } gwredir_change(); + tlsauth_change(); + autokey_change(); } - function autokey_change() { - var hide = $('#autokey_enable').prop('checked') - hideInput('shared_key', hide); - } - + // Process "Enable authentication of TLS packets" checkbox function tlsauth_change() { - var hide = ! $('#tlsauth_enable').prop('checked') - - <?php if (!$pconfig['tls']): ?> - hideCheckbox('autotls_enable', hide); - <?php endif; ?> - + hideCheckbox('autotls_enable', !$('#tlsauth_enable').prop('checked') && ($('#mode').val() != 'p2p_shared_key')); autotls_change(); } + // Process "Automatically generate a shared TLS authentication key" checkbox function autotls_change() { - <?php if (!$pconfig['tls']): ?> - autocheck = $('#autotls_enable').prop('checked'); - <?php else: ?> - autocheck = false; - <?php endif; ?> - - if ($('#tlsauth_enable').prop('checked') && !autocheck) - hideInput('tls', false); - else - hideInput('tls', true); + hideInput('tls', $('#autotls_enable').prop('checked') || !$('#tlsauth_enable').prop('checked')); + } + + function autokey_change() { + var hide = $('#autokey_enable').prop('checked') + hideInput('shared_key', hide); } function gwredir_change() { - var hide = $('#gwredir').prop('checked') + var hide = $('#gwredir').prop('checked') hideInput('local_network', hide); hideInput('local_networkv6', hide); @@ -1558,6 +1569,14 @@ events.push(function(){ // ---------- Library of show/hide functions ---------------------------------------------------------------------- + // Hides all elements of the specified class belonging to a multiselect. + function hideMultiClass(s_class, hide) { + if(hide) + $('.' + s_class).parent().parent().hide(); + else + $('.' + s_class).parent().parent().show(); + } + // Hides div whose label contains the specified text. (Good for StaticText) function hideLabel(text, hide) { |