mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 02:54:38 +00:00
(legacy) fix ldap import authentication container layout, closes https://github.com/opnsense/core/issues/673
This commit is contained in:
parent
3d33207e17
commit
13749d462a
@ -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.');?>");
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
@ -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,69 +49,65 @@ 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['binddn']) ? $_GET['binddn'] : null
|
||||
, !empty($_GET['bindpw']) ? $_GET['bindpw'] : null
|
||||
);
|
||||
if ($ldap_is_connected) {
|
||||
$ous = $ldap_auth->listOUs();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
function post_choices() {
|
||||
|
||||
var ous = <?php echo count($ous); ?>;
|
||||
var i;
|
||||
var values = jQuery("#ou:checked").map(function(){
|
||||
return jQuery(this).val();
|
||||
}).get().join(';');
|
||||
window.opener.document.getElementById('ldapauthcontainers').value=values;
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function post_choices() {
|
||||
var ous = <?php echo count($ous); ?>;
|
||||
var i;
|
||||
var values = $("#ou:checked").map(function(){
|
||||
return $(this).val();
|
||||
}).get().join(';');
|
||||
window.opener.document.getElementById('ldapauthcontainers').value=values;
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
<form method="post" action="system_usermanager_settings_ldapacpicker.php">
|
||||
<?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 :
|
||||
?>
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<input type='button' class="btn btn-primary" value='<?=gettext("Save");?>' onClick="post_choices();">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
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
|
||||
endif; ?>
|
||||
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>
|
||||
</tr>
|
||||
<?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();">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
endif; ?>
|
||||
</form>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user