From 9b7d05b1e75b9ba6bd9982fd2c698a99a18caef9 Mon Sep 17 00:00:00 2001 From: Shrihari Prakasam Date: Wed, 8 Jan 2025 18:09:16 +0530 Subject: [PATCH] Fix duplicate account prevention. --- src/service/api/user/create.post.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/api/user/create.post.ts b/src/service/api/user/create.post.ts index 51c5038..fdaa5f8 100644 --- a/src/service/api/user/create.post.ts +++ b/src/service/api/user/create.post.ts @@ -138,7 +138,7 @@ const POST_Create = async (req: Request, res: Response) => { .json(new ErrorResponse(errorMessages.clientInputError, { errors })); } const existingUser = (await UserModel.findOne({ - $or: [{ sanitizedEmail: sanitizeEmailAddress(email) }, { username }], + $or: [{ sanitizedEmail: sanitizeEmailAddress(email) }, { email }, { username }], }).exec()) as unknown as UserInterface; if (existingUser) { const duplicateFields = [];