mirror of
https://github.com/wheelybird/ldap-user-manager.git
synced 2025-01-31 05:59:19 +01:00
Formatting fixes, fix parsing params from account requests, initial code for the simple interface flag.
This commit is contained in:
parent
6a648c7684
commit
2ff87e98dc
@ -76,14 +76,24 @@ render_js_username_check();
|
||||
<input type="text" class="form-control invisible" name="group_name" id="group_name" placeholder="Group name" onkeyup="check_entity_name_validity(document.getElementById('group_name').value,'new_group_div');"><button id="add_group" class="form-control btn btn-primary btn-sm invisible" type="submit">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<input class="form-control" id="search_input" type="text" placeholder="Search..">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Group name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="grouplist">
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#search_input").on("keyup", function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$("#grouplist tr").filter(function() {
|
||||
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
foreach ($groups as $group){
|
||||
print " <tr>\n <td><a href='${THIS_MODULE_PATH}/show_group.php?group_name=" . urlencode($group) . "'>$group</a></td>\n </tr>\n";
|
||||
|
@ -53,7 +53,8 @@ $people = ldap_get_user_list($ldap_connection);
|
||||
<div class="container">
|
||||
<form action="<?php print $THIS_MODULE_PATH; ?>/new_user.php" method="post">
|
||||
<button type="button" class="btn btn-light"><?php print count($people);?> account<?php if (count($people) != 1) { print "s"; }?></button> <button id="add_group" class="btn btn-default" type="submit">New user</button>
|
||||
</form>
|
||||
</form>
|
||||
<input class="form-control" id="search_input" type="text" placeholder="Search..">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -64,7 +65,17 @@ $people = ldap_get_user_list($ldap_connection);
|
||||
<th>Member of</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="userlist">
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#search_input").on("keyup", function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$("#userlist tr").filter(function() {
|
||||
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
foreach ($people as $account_identifier => $attribs){
|
||||
|
||||
|
@ -82,24 +82,24 @@ if (isset($_GET['account_request'])) {
|
||||
|
||||
$givenname[0]=filter_var($_GET['first_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$new_account_r['givenname'] = $givenname;
|
||||
$givenname['count'] = 1;
|
||||
unset($new_account_r['givenname']['count']);
|
||||
|
||||
$sn[0]=filter_var($_GET['last_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$new_account_r['sn'][0] = $sn;
|
||||
$sn['count'] = 1;
|
||||
$new_account_r['sn'] = $sn;
|
||||
unset($new_account_r['sn']['count']);
|
||||
|
||||
$uid[0] = generate_username($givenname,$sn);
|
||||
$new_account_r['uid'][0] = $uid;
|
||||
$uid['count'] = 1;
|
||||
$uid[0] = generate_username($givenname[0],$sn[0]);
|
||||
$new_account_r['uid'] = $uid;
|
||||
unset($new_account_r['uid']['count']);
|
||||
|
||||
if ($ENFORCE_SAFE_SYSTEM_NAMES == TRUE) {
|
||||
$cn[0] = "$givenname$sn";
|
||||
$cn[0] = $givenname[0] . $sn[0];
|
||||
}
|
||||
else {
|
||||
$cn[0] = "$givenname $sn";
|
||||
$cn[0] = $givenname[0] . " " . $sn[0];
|
||||
}
|
||||
$new_account_r['cn'] = $cn;
|
||||
$cn['count'] = 1;
|
||||
unset($new_account_r['cn']['count']);
|
||||
|
||||
$mail[0]=filter_var($_GET['email'], FILTER_SANITIZE_EMAIL);
|
||||
if ($mail[0] == "") {
|
||||
@ -112,7 +112,7 @@ if (isset($_GET['account_request'])) {
|
||||
$disabled_email_tickbox = FALSE;
|
||||
}
|
||||
$new_account_r['mail'] = $mail;
|
||||
$mail['count'] = 1;
|
||||
unset($new_account_r['mail']['count']);
|
||||
|
||||
}
|
||||
|
||||
@ -121,7 +121,6 @@ if (isset($_POST['create_account'])) {
|
||||
$password = $_POST['password'];
|
||||
$new_account_r['password'][0] = $password;
|
||||
$account_identifier = $new_account_r[$account_attribute][0];
|
||||
|
||||
$this_cn=$cn[0];
|
||||
$this_mail=$mail[0];
|
||||
$this_givenname=$givenname[0];
|
||||
@ -310,7 +309,7 @@ $tabindex=1;
|
||||
<?php render_dynamic_field_js(); ?>
|
||||
|
||||
<div class="container">
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-8 col-md-offset-2">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading text-center"><?php print $page_title; ?></div>
|
||||
|
@ -18,8 +18,10 @@ $to_update = array();
|
||||
|
||||
if ($SMTP['host'] != "") { $can_send_email = TRUE; } else { $can_send_email = FALSE; }
|
||||
|
||||
$LDAP['default_attribute_map']["uidnumber"] = array("label" => "UID");
|
||||
$LDAP['default_attribute_map']["gidnumber"] = array("label" => "GID");
|
||||
if ($SIMPLE_INTERFACE == FALSE) {
|
||||
$LDAP['default_attribute_map']["uidnumber"] = array("label" => "UID");
|
||||
$LDAP['default_attribute_map']["gidnumber"] = array("label" => "GID");
|
||||
}
|
||||
$LDAP['default_attribute_map']["mail"] = array("label" => "Email", "onkeyup" => "check_if_we_should_enable_sending_email();");
|
||||
|
||||
$attribute_map = ldap_complete_account_attribute_array();
|
||||
|
@ -21,8 +21,15 @@ if (isset($_POST['change_password'])) {
|
||||
|
||||
render_header("$ORGANISATION_NAME account manager - password changed");
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<p class="text-center">Your password has been changed.</p>
|
||||
<div class="container">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">Success</div>
|
||||
<div class="panel-body">
|
||||
Your password has been updated.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
render_footer();
|
||||
@ -58,7 +65,7 @@ if (isset($mismatched)) { ?>
|
||||
<script type="text/javascript">$(document).ready(function(){ $("#StrengthProgressBar").zxcvbnProgressBar({ passwordInput: "#password" });});</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading text-center">Change your password</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
"uid" => array("label" => "System username", "onkeyup" => "check_entity_name_validity(document.getElementById('uid').value,'uid_div'); update_email(); check_email_validity(document.getElementById('mail').value);"),
|
||||
"cn" => array("label" => "Common name", "onkeyup" => "auto_cn_update = false;"),
|
||||
"mail" => array("label" => "Email", "onkeyup" => "auto_email_update = false; check_email_validity(document.getElementById('mail').value);")
|
||||
);
|
||||
);
|
||||
|
||||
#Mandatory
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
|
||||
#Optional
|
||||
|
||||
$SIMPLE_INTERFACE = ((strcasecmp(getenv('SIMPLE_INTERFACE'),'TRUE') == 0) ? TRUE : FALSE);
|
||||
|
||||
$LDAP['account_attribute'] = (getenv('LDAP_ACCOUNT_ATTRIBUTE') ? getenv('LDAP_ACCOUNT_ATTRIBUTE') : 'uid');
|
||||
$LDAP['group_attribute'] = (getenv('LDAP_GROUP_ATTRIBUTE') ? getenv('LDAP_GROUP_ATTRIBUTE') : 'cn');
|
||||
$LDAP['group_ou'] = (getenv('LDAP_GROUP_OU') ? getenv('LDAP_GROUP_OU') : 'groups');
|
||||
|
@ -50,7 +50,7 @@ else {
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-8 col-sm-offset-2">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading text-center">Log in</div>
|
||||
|
@ -83,22 +83,31 @@ EoT;
|
||||
|
||||
include_once "mail_functions.inc.php";
|
||||
$sent_email = send_email($ACCOUNT_REQUESTS_EMAIL,"$ORGANISATION_NAME account requests",$mail_subject,$mail_body);
|
||||
if ($sent_email) {
|
||||
$sent_email_message = " Thank you. The request was sent and the administrator will process it as soon as possible.";
|
||||
}
|
||||
else {
|
||||
$sent_email_message = " Unfortunately the request wasn't sent because of a technical problem.";
|
||||
}
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="col-sm-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body"><?php print $sent_email_message; ?></div>
|
||||
</div>
|
||||
if ($sent_email) { ?>
|
||||
<div class="container">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">Thank you</div>
|
||||
<div class="panel-body">
|
||||
The request was sent and the administrator will process it as soon as possible.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
else { ?>
|
||||
<div class="container">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div class="panel panel-danger">
|
||||
<div class="panel-heading">Error</div>
|
||||
<div class="panel-body">
|
||||
Unfortunately the account request wasn't sent because of a technical issue.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
render_footer();
|
||||
exit(0);
|
||||
|
||||
@ -106,7 +115,7 @@ EoT;
|
||||
}
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-8 col-sm-offset-2">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
Loading…
x
Reference in New Issue
Block a user