LDAP Wizard: determine port without credentials. don't hide the port input field

This commit is contained in:
Arthur Schiwon 2013-11-11 15:16:54 +01:00
parent ea9f392f4e
commit da61c6ef72
3 changed files with 12 additions and 13 deletions

View File

@ -202,7 +202,7 @@ var LdapWizard = {
}, },
function (result) { function (result) {
LdapWizard.hideSpinner('#ldap_base'); LdapWizard.hideSpinner('#ldap_base');
LdapWizard.showInfoBox('Please specify a port'); LdapWizard.showInfoBox('Please specify a Base DN');
} }
); );
} }
@ -210,28 +210,28 @@ var LdapWizard = {
checkPort: function() { checkPort: function() {
host = $('#ldap_host').val(); host = $('#ldap_host').val();
user = $('#ldap_dn').val(); port = $('#ldap_port').val();
pass = $('#ldap_agent_password').val();
if(host && user && pass) { if(host && !port) {
param = 'action=guessPortAndTLS'+ param = 'action=guessPortAndTLS'+
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
LdapWizard.showSpinner('#ldap_port'); LdapWizard.showSpinner('#ldap_port');
$('#ldap_port').prop('disabled', 'disabled');
LdapWizard.ajax(param, LdapWizard.ajax(param,
function(result) { function(result) {
LdapWizard.applyChanges(result); LdapWizard.applyChanges(result);
LdapWizard.hideSpinner('#ldap_port'); LdapWizard.hideSpinner('#ldap_port');
if($('#ldap_port').val()) { if($('#ldap_port').val()) {
LdapWizard.checkBaseDN(); LdapWizard.checkBaseDN();
$('#ldap_port').removeClass('invisible'); $('#ldap_port').prop('disabled', false);
LdapWizard.hideInfoBox(); LdapWizard.hideInfoBox();
} }
}, },
function (result) { function (result) {
LdapWizard.hideSpinner('#ldap_port'); LdapWizard.hideSpinner('#ldap_port');
$('#ldap_port').removeClass('invisible'); $('#ldap_port').prop('disabled', false);
LdapWizard.showInfoBox('Please specify the BaseDN'); LdapWizard.showInfoBox('Please specify the Port');
} }
); );
} }
@ -459,9 +459,6 @@ var LdapWizard = {
}, },
init: function() { init: function() {
if($('#ldap_port').val()) {
$('#ldap_port').removeClass('invisible');
}
LdapWizard.basicStatusCheck(); LdapWizard.basicStatusCheck();
}, },
@ -516,6 +513,8 @@ var LdapWizard = {
}, },
processChanges: function(triggerObj) { processChanges: function(triggerObj) {
LdapWizard.hideInfoBox();
if(triggerObj.id == 'ldap_host' if(triggerObj.id == 'ldap_host'
|| triggerObj.id == 'ldap_port' || triggerObj.id == 'ldap_port'
|| triggerObj.id == 'ldap_dn' || triggerObj.id == 'ldap_dn'

View File

@ -995,9 +995,9 @@ class Wizard extends LDAPUtility {
//In case the port is already provided, we will check this first //In case the port is already provided, we will check this first
if($port > 0) { if($port > 0) {
$hostInfo = parse_url($host); $hostInfo = parse_url($host);
if(is_array($hostInfo) if(!(is_array($hostInfo)
&& isset($hostInfo['scheme']) && isset($hostInfo['scheme'])
&& stripos($hostInfo['scheme'], 'ldaps') === false) { && stripos($hostInfo['scheme'], 'ldaps') !== false)) {
$portSettings[] = array('port' => $port, 'tls' => true); $portSettings[] = array('port' => $port, 'tls' => true);
} }
$portSettings[] =array('port' => $port, 'tls' => false); $portSettings[] =array('port' => $port, 'tls' => false);

View File

@ -32,7 +32,7 @@
/> />
<span> <span>
<input type="number" id="ldap_port" name="ldap_port" <input type="number" id="ldap_port" name="ldap_port"
class="invisible lwautosave" class="lwautosave"
placeholder="<?php p($l->t('Port'));?>" /> placeholder="<?php p($l->t('Port'));?>" />
</span> </span>
</div> </div>