fix normlize email to avoid lockout

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2026-06-14 15:28:36 +02:00
parent b193742cc8
commit 61d2ba169e
+5 -2
View File
@@ -419,7 +419,10 @@ func (r *User) GetByUsername(
return ToUser(dbUser)
}
// GetByEmail gets a user by email
// GetByEmail gets a user by a case insensitive email match. the address is
// compared with LOWER() on both sides so differently cased addresses such as
// Alice@corp.com and alice@corp.com resolve to the same user. this keeps SSO
// login matching and the email uniqueness checks robust to casing.
func (r *User) GetByEmail(
ctx context.Context,
email *vo.Email,
@@ -429,7 +432,7 @@ func (r *User) GetByEmail(
result := r.with(options, r.DB).
Where(
fmt.Sprintf(
"%s = ?",
"LOWER(%s) = LOWER(?)",
TableColumn(database.USER_TABLE, "email"),
),
email.String(),