diff options
author | Joas Schilling <coding@schilljs.com> | 2021-12-10 12:18:02 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-12-10 15:01:27 +0100 |
commit | ae365269780e2ae2cd757696042fbbfa6729e3c4 (patch) | |
tree | d930d6e3a458efecc30addd4a12e118f3d7a33ab /lib/private | |
parent | d851e5878270e113ba6fb37f25539c60d8b3cc30 (diff) | |
download | nextcloud-server-ae365269780e2ae2cd757696042fbbfa6729e3c4.tar.gz nextcloud-server-ae365269780e2ae2cd757696042fbbfa6729e3c4.zip |
Always store and compare the email address as lower case
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AllConfig.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 40a52b16628..45ed77e7888 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -260,6 +260,10 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); + if ($appName === 'core' && $key === 'email') { + $value = strtolower($value); + } + $prevValue = $this->getUserValue($userId, $appName, $key, null); if ($prevValue !== null) { @@ -514,17 +518,22 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); + if ($appName === 'core' && $key === 'email') { + // Email address is always stored lowercase in the database + return $this->getUsersForUserValue($appName, $key, strtolower($value)); + } + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . 'WHERE `appid` = ? AND `configkey` = ? '; if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { //oracle hack: need to explicitly cast CLOB to CHAR for comparison - $sql .= 'AND LOWER(to_char(`configvalue`)) = LOWER(?)'; + $sql .= 'AND LOWER(to_char(`configvalue`)) = ?'; } else { - $sql .= 'AND LOWER(`configvalue`) = LOWER(?)'; + $sql .= 'AND LOWER(`configvalue`) = ?'; } - $result = $this->connection->executeQuery($sql, [$appName, $key, $value]); + $result = $this->connection->executeQuery($sql, [$appName, $key, strtolower($value)]); $userIDs = []; while ($row = $result->fetch()) { |