Browse Source
fix: revive always storing lowercased email addresses
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
pull/53615/head
Richard Steinmetz
7 months ago
No known key found for this signature in database
GPG Key ID: 27137D9E7D273FB2
8 changed files with
70 additions and
1 deletions
-
build/integration/features/provisioning-v1.feature
-
core/Migrations/Version32000Date20250620081925.php
-
lib/composer/composer/autoload_classmap.php
-
lib/composer/composer/autoload_static.php
-
lib/private/Config/UserConfig.php
-
tests/lib/AllConfigTest.php
-
tests/lib/Config/UserConfigTest.php
-
version.php
|
|
|
@ -187,6 +187,18 @@ Feature: provisioning |
|
|
|
| timezoneOffset | 0 | |
|
|
|
| pronouns | NULL | |
|
|
|
|
|
|
|
Scenario: Edit a user with mixed case emails |
|
|
|
Given As an "admin" |
|
|
|
And user "brand-new-user" exists |
|
|
|
And sending "PUT" to "/cloud/users/brand-new-user" with |
|
|
|
| key | email | |
|
|
|
| value | mixed-CASE@Nextcloud.com | |
|
|
|
And the OCS status code should be "100" |
|
|
|
And the HTTP status code should be "200" |
|
|
|
Then user "brand-new-user" has |
|
|
|
| id | brand-new-user | |
|
|
|
| email | mixed-case@nextcloud.com | |
|
|
|
|
|
|
|
Scenario: Edit a user account properties scopes |
|
|
|
Given user "brand-new-user" exists |
|
|
|
And As an "brand-new-user" |
|
|
|
|
|
|
|
@ -0,0 +1,16 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
declare(strict_types=1); |
|
|
|
|
|
|
|
/** |
|
|
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
|
|
|
*/ |
|
|
|
|
|
|
|
namespace OC\Core\Migrations; |
|
|
|
|
|
|
|
/** |
|
|
|
* Run the old migration Version24000Date20211210141942 again. |
|
|
|
*/ |
|
|
|
class Version32000Date20250620081925 extends Version24000Date20211210141942 { |
|
|
|
} |
|
|
|
@ -1472,6 +1472,7 @@ return array( |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20240101084401' => $baseDir . '/core/Migrations/Version31000Date20240101084401.php', |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20240814184402' => $baseDir . '/core/Migrations/Version31000Date20240814184402.php', |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20250213102442' => $baseDir . '/core/Migrations/Version31000Date20250213102442.php', |
|
|
|
'OC\\Core\\Migrations\\Version32000Date20250620081925' => $baseDir . '/core/Migrations/Version32000Date20250620081925.php', |
|
|
|
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php', |
|
|
|
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php', |
|
|
|
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php', |
|
|
|
|
|
|
|
@ -1513,6 +1513,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20240101084401' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20240101084401.php', |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20240814184402' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20240814184402.php', |
|
|
|
'OC\\Core\\Migrations\\Version31000Date20250213102442' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20250213102442.php', |
|
|
|
'OC\\Core\\Migrations\\Version32000Date20250620081925' => __DIR__ . '/../../..' . '/core/Migrations/Version32000Date20250620081925.php', |
|
|
|
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php', |
|
|
|
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php', |
|
|
|
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php', |
|
|
|
|
|
|
|
@ -1045,6 +1045,11 @@ class UserConfig implements IUserConfig { |
|
|
|
int $flags, |
|
|
|
ValueType $type, |
|
|
|
): bool { |
|
|
|
// Primary email addresses are always(!) expected to be lowercase
|
|
|
|
if ($app === 'settings' && $key === 'email') { |
|
|
|
$value = strtolower($value); |
|
|
|
} |
|
|
|
|
|
|
|
$this->assertParams($userId, $app, $key); |
|
|
|
if (!$this->matchAndApplyLexiconDefinition($userId, $app, $key, $lazy, $type, $flags)) { |
|
|
|
// returns false as database is not updated
|
|
|
|
|
|
|
|
@ -93,6 +93,27 @@ class AllConfigTest extends \Test\TestCase { |
|
|
|
$config->deleteUserValue('userSet', 'appSet', 'keySet'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* This test needs to stay! Emails are expected to be lowercase due to performance reasons. |
|
|
|
* This way we can skip the expensive casing change on the database. |
|
|
|
*/ |
|
|
|
public function testSetUserValueSettingsEmail(): void { |
|
|
|
$selectAllSQL = 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?'; |
|
|
|
$config = $this->getConfig(); |
|
|
|
|
|
|
|
$config->setUserValue('userSet', 'settings', 'email', 'mixed.CASE@domain.COM'); |
|
|
|
|
|
|
|
$result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); |
|
|
|
|
|
|
|
$this->assertEquals(1, count($result)); |
|
|
|
$this->assertEquals([ |
|
|
|
'userid' => 'userSet', |
|
|
|
'appid' => 'settings', |
|
|
|
'configkey' => 'email', |
|
|
|
'configvalue' => 'mixed.case@domain.com' |
|
|
|
], $result[0]); |
|
|
|
} |
|
|
|
|
|
|
|
public function testSetUserValueWithPreCondition(): void { |
|
|
|
$config = $this->getConfig(); |
|
|
|
|
|
|
|
|
|
|
|
@ -1241,6 +1241,19 @@ class UserConfigTest extends TestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* This test needs to stay! Emails are expected to be lowercase due to performance reasons. |
|
|
|
* This way we can skip the expensive casing change on the database. |
|
|
|
*/ |
|
|
|
public function testSetValueMixedWithSettingsEmail(): void { |
|
|
|
$userConfig = $this->generateUserConfig(); |
|
|
|
|
|
|
|
$edited = $userConfig->setValueMixed('user1', 'settings', 'email', 'mixed.CASE@Nextcloud.com'); |
|
|
|
$this->assertTrue($edited); |
|
|
|
|
|
|
|
$actual = $userConfig->getValueMixed('user1', 'settings', 'email'); |
|
|
|
$this->assertEquals('mixed.case@nextcloud.com', $actual); |
|
|
|
} |
|
|
|
|
|
|
|
public static function providerSetValueString(): array { |
|
|
|
return [ |
|
|
|
|
|
|
|
@ -9,7 +9,7 @@ |
|
|
|
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patch level
|
|
|
|
// when updating major/minor version number.
|
|
|
|
|
|
|
|
$OC_Version = [32, 0, 0, 0]; |
|
|
|
$OC_Version = [32, 0, 0, 1]; |
|
|
|
|
|
|
|
// The human-readable string
|
|
|
|
$OC_VersionString = '32.0.0 dev'; |
|
|
|
|