mirror of
https://github.com/wheelybird/ldap-user-manager.git
synced 2025-01-18 23:42:54 +01:00
Issue 163 (#168)
* Issue #163 - password reset warnings * Fix errors showing when accounts don't have an email. Fix errors when sending an email on password reset. Prevent PHPMailer trying to use TLS when it's disabled. Co-authored-by: Brian Lycett <brian.lycett.nonstaff@which.co.uk>
This commit is contained in:
parent
1db9635bf1
commit
d79e58346d
@ -62,11 +62,12 @@ $people = ldap_get_user_list($ldap_connection);
|
|||||||
foreach ($people as $account_identifier => $attribs){
|
foreach ($people as $account_identifier => $attribs){
|
||||||
|
|
||||||
$group_membership = ldap_user_group_membership($ldap_connection,$account_identifier);
|
$group_membership = ldap_user_group_membership($ldap_connection,$account_identifier);
|
||||||
|
if (isset($people[$account_identifier]['mail'])) { $this_mail = $people[$account_identifier]['mail']; } else { $this_mail = ""; }
|
||||||
|
|
||||||
print " <tr>\n <td><a href='${THIS_MODULE_PATH}/show_user.php?account_identifier=" . urlencode($account_identifier) . "'>$account_identifier</a></td>\n";
|
print " <tr>\n <td><a href='${THIS_MODULE_PATH}/show_user.php?account_identifier=" . urlencode($account_identifier) . "'>$account_identifier</a></td>\n";
|
||||||
print " <td>" . $people[$account_identifier]['givenname'] . "</td>\n";
|
print " <td>" . $people[$account_identifier]['givenname'] . "</td>\n";
|
||||||
print " <td>" . $people[$account_identifier]['sn'] . "</td>\n";
|
print " <td>" . $people[$account_identifier]['sn'] . "</td>\n";
|
||||||
print " <td>" . $people[$account_identifier]['mail'] . "</td>\n";
|
print " <td>$this_mail</td>\n";
|
||||||
print " <td>" . implode(", ", $group_membership) . "</td>\n";
|
print " <td>" . implode(", ", $group_membership) . "</td>\n";
|
||||||
print " </tr>\n";
|
print " </tr>\n";
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,11 @@ foreach ($attribute_map as $attribute => $attr_r) {
|
|||||||
if (isset($_GET['account_request'])) {
|
if (isset($_GET['account_request'])) {
|
||||||
|
|
||||||
$givenname[0]=filter_var($_GET['first_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
$givenname[0]=filter_var($_GET['first_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||||
$new_account_r['givenname'] = $givenname;
|
$new_account_r['givenname'] = $givenname[0];
|
||||||
unset($new_account_r['givenname']['count']);
|
unset($new_account_r['givenname']['count']);
|
||||||
|
|
||||||
$sn[0]=filter_var($_GET['last_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
$sn[0]=filter_var($_GET['last_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||||
$new_account_r['sn'] = $sn;
|
$new_account_r['sn'] = $sn[0];
|
||||||
unset($new_account_r['sn']['count']);
|
unset($new_account_r['sn']['count']);
|
||||||
|
|
||||||
$mail[0]=filter_var($_GET['email'], FILTER_SANITIZE_EMAIL);
|
$mail[0]=filter_var($_GET['email'], FILTER_SANITIZE_EMAIL);
|
||||||
|
@ -184,12 +184,12 @@ if ($ldap_search) {
|
|||||||
|
|
||||||
include_once "mail_functions.inc.php";
|
include_once "mail_functions.inc.php";
|
||||||
|
|
||||||
$mail_body = parse_mail_text($new_account_mail_body, $password, $account_identifier, $givenname, $sn);
|
$mail_body = parse_mail_text($new_account_mail_body, $password, $account_identifier, $givenname[0], $sn[0]);
|
||||||
$mail_subject = parse_mail_text($new_account_mail_subject, $password, $account_identifier, $givenname, $sn);
|
$mail_subject = parse_mail_text($new_account_mail_subject, $password, $account_identifier, $givenname[0], $sn[0]);
|
||||||
|
|
||||||
$sent_email = send_email($mail,"$givenname $sn",$mail_subject,$mail_body);
|
$sent_email = send_email($mail[0],"${givenname[0]} ${sn[0]}",$mail_subject,$mail_body);
|
||||||
if ($sent_email) {
|
if ($sent_email) {
|
||||||
$sent_email_message .= " An email sent to $mail.";
|
$sent_email_message .= " An email sent to ${mail[0]}.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sent_email_message .= " Unfortunately the email wasn't sent; check the logs for more information.";
|
$sent_email_message .= " Unfortunately the email wasn't sent; check the logs for more information.";
|
||||||
|
@ -64,6 +64,7 @@ function send_email($recipient_email,$recipient_name,$subject,$body) {
|
|||||||
if ($SMTP['tls'] == TRUE) { $mail->SMTPSecure = 'tls'; }
|
if ($SMTP['tls'] == TRUE) { $mail->SMTPSecure = 'tls'; }
|
||||||
if ($SMTP['ssl'] == TRUE) { $mail->SMTPSecure = 'ssl'; }
|
if ($SMTP['ssl'] == TRUE) { $mail->SMTPSecure = 'ssl'; }
|
||||||
|
|
||||||
|
$mail->SMTPAutoTLS = false;
|
||||||
$mail->setFrom($EMAIL['from_address'], $EMAIL['from_name']);
|
$mail->setFrom($EMAIL['from_address'], $EMAIL['from_name']);
|
||||||
$mail->addAddress($recipient_email, $recipient_name);
|
$mail->addAddress($recipient_email, $recipient_name);
|
||||||
$mail->Subject = $subject;
|
$mail->Subject = $subject;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user