From 949d782a28f34a0d18cdf5ac732b52d8be69840c Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:49:43 +0100 Subject: [PATCH] make emails case-insensitive --- apps/server/src/database/repos/user/user.repo.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/server/src/database/repos/user/user.repo.ts b/apps/server/src/database/repos/user/user.repo.ts index a521d677..c73f26f7 100644 --- a/apps/server/src/database/repos/user/user.repo.ts +++ b/apps/server/src/database/repos/user/user.repo.ts @@ -6,15 +6,11 @@ import { hashPassword } from '../../../common/helpers'; import { dbOrTx } from '@docmost/db/utils'; import { InsertableUser, - Space, UpdatableUser, User, } from '@docmost/db/types/entity.types'; import { PaginationOptions } from '../../pagination/pagination-options'; -import { - executeWithPagination, - PaginationResult, -} from '@docmost/db/pagination/pagination'; +import { executeWithPagination } from '@docmost/db/pagination/pagination'; import { sql } from 'kysely'; @Injectable() @@ -66,7 +62,7 @@ export class UserRepo { .selectFrom('users') .select(this.baseFields) .$if(includePassword, (qb) => qb.select('password')) - .where('email', '=', email) + .where(sql`LOWER(email)`, '=', sql`LOWER(${email})`) .where('workspaceId', '=', workspaceId) .executeTakeFirst(); }