From f82d2a8c4f0ca9e850eabe0720b3ebf3a0b80cfd Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Wed, 9 Nov 2022 15:33:07 +0800 Subject: [PATCH] refactor(core)!: use case insensitive search for emails --- packages/core/src/queries/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/queries/user.ts b/packages/core/src/queries/user.ts index 6a4e70881..6a8d43cc8 100644 --- a/packages/core/src/queries/user.ts +++ b/packages/core/src/queries/user.ts @@ -21,7 +21,7 @@ export const findUserByEmail = async (email: string) => envSet.pool.one(sql` select ${sql.join(Object.values(fields), sql`,`)} from ${table} - where ${fields.primaryEmail}=${email} + where lower(${fields.primaryEmail})=lower(${email}) `); export const findUserByPhone = async (phone: string) => @@ -65,7 +65,7 @@ export const hasUserWithEmail = async (email: string) => envSet.pool.exists(sql` select ${fields.primaryEmail} from ${table} - where ${fields.primaryEmail}=${email} + where lower(${fields.primaryEmail})=lower(${email}) `); export const hasUserWithPhone = async (phone: string) =>