fix: enforce lowercase email addresses

This commit is contained in:
Björn Fromme
2026-08-31 17:11:13 +02:00
committed by fromme
parent 703d41d6ae
commit 53465cc66a
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ class UserDataHandler
} }
$users = $repository->findBy([ $users = $repository->findBy([
'email' => $email, 'email' => mb_strtolower(trim($email)),
]); ]);
if (1 !== count($users)) { if (1 !== count($users)) {
+1 -1
View File
@@ -184,7 +184,7 @@ class User implements UserInterface, TimestampableEntityInterface, SoftDeletable
public function setEmail(string $email): static public function setEmail(string $email): static
{ {
$this->email = $email; $this->email = mb_strtolower(trim($email));
return $this; return $this;
} }
+3 -2
View File
@@ -255,6 +255,7 @@ class MyEpAuthenticator extends AbstractAuthenticator
$addressId = $userinfo['address_id'] ?? null; $addressId = $userinfo['address_id'] ?? null;
$personId = $userinfo['person_id'] ?? null; $personId = $userinfo['person_id'] ?? null;
$email = mb_strtolower(trim($userinfo['email']));
if (null !== $addressId && null !== $personId) { if (null !== $addressId && null !== $personId) {
$user = $repository->findOneBy([ $user = $repository->findOneBy([
@@ -267,12 +268,12 @@ class MyEpAuthenticator extends AbstractAuthenticator
} }
} }
$users = $repository->findBy(['email' => $userinfo['email']]); $users = $repository->findBy(['email' => $email]);
if (1 !== count($users)) { if (1 !== count($users)) {
if (1 < count($users)) { if (1 < count($users)) {
$this->logger->warning('Unable to match local user by email: multiple users found', [ $this->logger->warning('Unable to match local user by email: multiple users found', [
'email' => $userinfo['email'], 'email' => $email,
'count' => count($users), 'count' => count($users),
]); ]);
} }