]> source.dussan.org Git - nextcloud-server.git/commitdiff
Prevent setting email and triggering events at login time (#25554) 593/head
authorVincent Petry <pvince81@owncloud.com>
Tue, 26 Jul 2016 19:09:25 +0000 (21:09 +0200)
committerBjoern Schiessle <bjoern@schiessle.org>
Wed, 27 Jul 2016 09:32:10 +0000 (11:32 +0200)
Whenever an LDAP user also has an email address defined in LDAP, the
LDAP code will try and update the email address of the locally known
user. This happens at login time or every time the user's LDAP
attributes are processed.

There is code listening to the email setting hook which updates the
system address book, which also will trigger FS setup due to avatars
and other things.

This fix only sets the email address when really necessary.

apps/user_ldap/lib/User/User.php

index 56d881c5d5acc0baa9e9c60bace2b420321156c3..3d247663b3f0dac993ac726bfdc421f6dda4d14a 100644 (file)
@@ -435,7 +435,10 @@ class User {
                if(!is_null($email)) {
                        $user = $this->userManager->get($this->uid);
                        if (!is_null($user)) {
-                               $user->setEMailAddress($email);
+                               $currentEmail = $user->getEMailAddress();
+                               if ($currentEmail !== $email) {
+                                       $user->setEMailAddress($email);
+                               }
                        }
                }
        }