Skip to content

Commit 8734b6d

Browse files
committed
fix: case-insensitive user emails - issue #89
1 parent 0d2c0b8 commit 8734b6d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

models/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func NewUser(instanceID uuid.UUID, email, password, aud string, userData map[str
6565
InstanceID: instanceID,
6666
ID: id,
6767
Aud: aud,
68-
Email: email,
68+
Email: strings.ToLower(email),
6969
UserMetaData: userData,
7070
EncryptedPassword: pw,
7171
}
@@ -265,7 +265,7 @@ func FindUserByConfirmationToken(tx *storage.Connection, token string) (*User, e
265265

266266
// FindUserByEmailAndAudience finds a user with the matching email and audience.
267267
func FindUserByEmailAndAudience(tx *storage.Connection, instanceID uuid.UUID, email, aud string) (*User, error) {
268-
return findUser(tx, "instance_id = ? and email = ? and aud = ?", instanceID, email, aud)
268+
return findUser(tx, "instance_id = ? and LOWER(email) = ? and aud = ?", instanceID, strings.ToLower(email), aud)
269269
}
270270

271271
// FindUserByID finds a user matching the provided ID.

0 commit comments

Comments
 (0)