From ed4677557c3195935da574ba60e7a22177f83f6c Mon Sep 17 00:00:00 2001 From: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> Date: Mon, 7 Nov 2022 15:12:14 -0300 Subject: [PATCH] [FIX] User merge by e-mail on OAuth is case-sensitive (#27167) --- apps/meteor/app/models/server/models/Users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/models/server/models/Users.js b/apps/meteor/app/models/server/models/Users.js index e94a2458104bc..181fbfdeb9172 100644 --- a/apps/meteor/app/models/server/models/Users.js +++ b/apps/meteor/app/models/server/models/Users.js @@ -689,7 +689,7 @@ export class Users extends Base { findOneByEmailAddressAndServiceNameIgnoringCase(emailAddress, userId, serviceName, options) { const query = { - 'emails.address': String(emailAddress).trim().toLowerCase(), + 'emails.address': new RegExp(`^${escapeRegExp(String(emailAddress).trim())}$`, 'i'), [`services.${serviceName}.id`]: userId, };