Commit 13749d46 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) fix ldap import authentication container layout, closes...

(legacy) fix  ldap import authentication container layout, closes https://github.com/opnsense/core/issues/673
parent 3d33207e
......@@ -320,7 +320,7 @@ else :?>
url += '&cert=';
<?php
endif; ?>
var oWin = window.open(url,"OPNsense","width=620,height=400,top=150,left=150");
var oWin = window.open(url,"OPNsense","width=620,height=400,top=150,left=150, scrollbars=yes");
if (oWin==null || typeof(oWin)=="undefined")
alert("<?=gettext('Popup blocker detected. Action aborted.');?>");
}
......
......@@ -31,7 +31,6 @@ require_once("auth.inc");
include('head.inc');
$ous = array();
if (isset($_GET['basedn']) && isset($_GET['host'])) {
if (isset($_GET['cert'])) {
$authcfg = array();
......@@ -50,9 +49,7 @@ if (isset($_GET['basedn']) && isset($_GET['host'])) {
$ldap_full_url .= ":{$_GET['port']}";
}
$ldap_auth = new OPNsense\Auth\LDAP($_GET['basedn']
, isset($_GET['proto']) ? $_GET['proto'] : 3
);
$ldap_auth = new OPNsense\Auth\LDAP($_GET['basedn'], isset($_GET['proto']) ? $_GET['proto'] : 3);
$ldap_is_connected = $ldap_auth->connect($ldap_full_url
, !empty($_GET['binddn']) ? $_GET['binddn'] : null
, !empty($_GET['bindpw']) ? $_GET['bindpw'] : null
......@@ -61,49 +58,43 @@ if (isset($_GET['basedn']) && isset($_GET['host'])) {
$ous = $ldap_auth->listOUs();
}
}
?>
<body>
<script type="text/javascript">
function post_choices() {
function post_choices() {
var ous = <?php echo count($ous); ?>;
var i;
var values = jQuery("#ou:checked").map(function(){
return jQuery(this).val();
var values = $("#ou:checked").map(function(){
return $(this).val();
}).get().join(';');
window.opener.document.getElementById('ldapauthcontainers').value=values;
window.close();
}
</script>
}
</script>
<form method="post" action="system_usermanager_settings_ldapacpicker.php">
<?php if (empty($ous)) :
?>
<?php
if (empty($ous)) :?>
<p><?=gettext("Could not connect to the LDAP server. Please check your LDAP configuration.");?></p>
<input type='button' class="btn btn-default" value='<?=gettext("Close"); ?>' onClick="window.close();">
<?php
else :
?>
else :?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<th>
<?=gettext("Please select which containers to Authenticate against:");?>
</th>
<th><?=gettext("Please select which containers to Authenticate against:");?></th>
</tr>
<?php
if (is_array($ous)) {
foreach ($ous as $ou) {
if (in_array($ou, $ldap_authcn)) {
$CHECKED=" CHECKED";
} else {
$CHECKED="";
}
echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}</td></tr>\n";
}
}
?>
<?php
foreach ($ous as $ou):?>
<tr>
<td><input type='checkbox' value='<?=$ou;?>' id='ou' name='ou[]' <?=in_array($ou, $ldap_authcn) ? "CHECKED": "";?>> <?=$ou;?></td>
</tr>
<?php
endforeach;?>
<tr>
<td align="right">
<input type='button' class="btn btn-primary" value='<?=gettext("Save");?>' onClick="post_choices();">
......@@ -111,8 +102,12 @@ else :
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
<?php
endif; ?>
endif; ?>
</form>
</body>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment