Skip to content

Commit

Permalink
I dug into it again, and the issue is much simpler than I previously …
Browse files Browse the repository at this point in the history
…though.

- LDAP has an email address with capital letters
- NC store this address in lower case
- When the user logs in, we compare the [stored email with the new lower case email](https://github.com/nextcloud/server/blob/master/lib/private/AllConfig.php#L259-L261) before storing it. Here, both email will be the same, so we won't store the new email address with upper case letters. Which is what we want.
- We then [compare emails as they are before triggering an event](https://github.com/nextcloud/server/blob/master/lib/private/User/User.php#L202-L204), they won't match, so the user will receive an email signaling an email change every time he logs in.

The fix is to compare the old email with the new lower case email before sending the event.

Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Sep 6, 2022
1 parent 5104ee9 commit 6c11944
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function setSystemEMailAddress(string $mailAddress): void {
$this->setPrimaryEMailAddress('');
}

if ($oldMailAddress !== $mailAddress) {
if ($oldMailAddress !== strtolower($mailAddress)) {
$this->triggerChange('eMailAddress', $mailAddress, $oldMailAddress);
}
}
Expand Down

0 comments on commit 6c11944

Please sign in to comment.