diff --git a/server/src/controllers/auth.controller.ts b/server/src/controllers/auth.controller.ts index c9d8ac5..e1f4e37 100644 --- a/server/src/controllers/auth.controller.ts +++ b/server/src/controllers/auth.controller.ts @@ -252,8 +252,9 @@ export const updateUser = async (req: Request, res: Response) => { } const email = xss(req.body.email || req.session.user.email); + const compareEmail = email || name; - const duplicateUsers = await UserModel.findByNameEmail({ name, email }); + const duplicateUsers = await UserModel.findByNameEmail({ name, email: compareEmail }); if ( duplicateUsers && duplicateUsers.length &&