Skip to content

Commit

Permalink
Merge pull request #49404 from Thatoo/Thatoo-patch-1
Browse files Browse the repository at this point in the history
fix(user_ldap): retrieve from LDAP first "email shaped" value instead…
  • Loading branch information
blizzz authored Dec 5, 2024
2 parents 7bc21d8 + 486f0ed commit c9073f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/user_ldap/lib/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ public function processAttributes($ldapEntry) {
//change event that will trigger fetching the display name again
$attr = strtolower($this->connection->ldapEmailAttribute);
if (isset($ldapEntry[$attr])) {
$this->updateEmail($ldapEntry[$attr][0]);
$mailValue = 0;
for ($x = 0; $x < count($ldapEntry[$attr]); $x++) {
if (filter_var($ldapEntry[$attr][$x], FILTER_VALIDATE_EMAIL)) {
$mailValue = $x;
break;
}
}
$this->updateEmail($ldapEntry[$attr][$mailValue]);
}
unset($attr);

Expand Down

0 comments on commit c9073f7

Please sign in to comment.