Prevent setting email and triggering events at login time (#25554)

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.
This commit is contained in:
Vincent Petry 2016-07-26 21:09:25 +02:00 committed by Bjoern Schiessle
parent cb10ca5c23
commit b9266e7141
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 4 additions and 1 deletions

View File

@ -435,10 +435,13 @@ class User {
if(!is_null($email)) { if(!is_null($email)) {
$user = $this->userManager->get($this->uid); $user = $this->userManager->get($this->uid);
if (!is_null($user)) { if (!is_null($user)) {
$currentEmail = $user->getEMailAddress();
if ($currentEmail !== $email) {
$user->setEMailAddress($email); $user->setEMailAddress($email);
} }
} }
} }
}
/** /**
* fetches the quota from LDAP and stores it as ownCloud user value * fetches the quota from LDAP and stores it as ownCloud user value