Commit 1335f009 authored by Richard Mansfield's avatar Richard Mansfield

Update email field from LDAP server (bug #536978). Thanks to Andrej Vitez.

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent b5181dde
......@@ -123,12 +123,13 @@ class AuthLdap extends Auth {
$ldapattributes = array();
$ldapattributes['firstname'] = $this->config['firstnamefield'];
$ldapattributes['lastname'] = $this->config['surnamefield' ];
$ldapattributes['email'] = $this->config['emailfield' ];
// Retrieve information of user from LDAP
$ldapdetails = $this->get_userinfo_ldap($username, $ldapattributes);
// Match database and ldap entries and update in database if required
$fieldstoimport = array('firstname', 'lastname');
$fieldstoimport = array('firstname', 'lastname', 'email');
foreach ($fieldstoimport as $field) {
if ($user->$field != $ldapdetails[$field]) {
$user->$field = $ldapdetails[$field];
......
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