diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-12-19 15:33:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 15:33:15 +0100 |
commit | a6c11af60dcaa4d47c00254a8f77cf7b66e663ca (patch) | |
tree | a9b9b435e265bb1963e44502f144f9b8ab1e7c35 /apps | |
parent | 1efbbd885c628c1f4cc777479988e0a10427f4e1 (diff) | |
parent | bf4f0d37f8bb3bb24f38bceb524705de54ebe137 (diff) | |
download | nextcloud-server-a6c11af60dcaa4d47c00254a8f77cf7b66e663ca.tar.gz nextcloud-server-a6c11af60dcaa4d47c00254a8f77cf7b66e663ca.zip |
Merge pull request #35803 from nextcloud/backport/34629/stable25
[stable25] Fix case sensitivity of email when saving settings
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/Controller/UsersController.php | 2 | ||||
-rw-r--r-- | apps/settings/tests/Controller/UsersControllerTest.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index 6be93d6a3a0..3a43442bda4 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -484,7 +484,7 @@ class UsersController extends Controller { $oldEmailAddress = $userAccount->getUser()->getSystemEMailAddress(); $oldEmailAddress = strtolower((string)$oldEmailAddress); - if ($oldEmailAddress !== $userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue()) { + if ($oldEmailAddress !== strtolower($userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue())) { // this is the only permission a backend provides and is also used // for the permission of setting a email address if (!$userAccount->getUser()->canChangeDisplayName()) { diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 797fa1621fa..ba7d9689130 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -624,7 +624,7 @@ class UsersControllerTest extends \Test\TestCase { $user->method('getSystemEMailAddress')->willReturn($oldEmailAddress); $user->method('canChangeDisplayName')->willReturn(true); - if ($data[IAccountManager::PROPERTY_EMAIL]['value'] === $oldEmailAddress || + if (strtolower($data[IAccountManager::PROPERTY_EMAIL]['value']) === strtolower($oldEmailAddress) || ($oldEmailAddress === null && $data[IAccountManager::PROPERTY_EMAIL]['value'] === '')) { $user->expects($this->never())->method('setSystemEMailAddress'); } else { @@ -720,6 +720,14 @@ class UsersControllerTest extends \Test\TestCase { 'john@example.com', null ], + [ + [ + IAccountManager::PROPERTY_EMAIL => ['value' => 'john@example.com'], + IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'], + ], + 'JOHN@example.com', + null + ], ]; } |