diff options
author | Thatoo <Thatoo@users.noreply.github.com> | 2024-11-20 16:55:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 16:55:44 +0100 |
commit | 486f0eda718b49c2df5c8996c96a0e61ffca0a70 (patch) | |
tree | a9e43cd921ffe5a368413a33e77a2bea43c5110a /apps | |
parent | 3822db51742eb12c67b525cab80ec0699e011684 (diff) | |
download | nextcloud-server-486f0eda718b49c2df5c8996c96a0e61ffca0a70.tar.gz nextcloud-server-486f0eda718b49c2df5c8996c96a0e61ffca0a70.zip |
fix(user_ldap): retrieve from LDAP first "email shaped" value instead of first value
Signed-off-by: Thatoo <Thatoo@users.noreply.github.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/User/User.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 7ef36ff1512..824d12c52e1 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -154,7 +154,14 @@ class User { //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); |