From b92ffe897f00737751ee4d893fd7acfefc6459d1 Mon Sep 17 00:00:00 2001 From: Mehmet Kozan Date: Tue, 28 Mar 2023 15:49:21 +0300 Subject: [PATCH] Update users.js if username not includes "@" or not an email, tools.normalizeAddress() function not working correctly. --- lib/api/users.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/api/users.js b/lib/api/users.js index 64aba790..e5a4bfb1 100644 --- a/lib/api/users.js +++ b/lib/api/users.js @@ -583,12 +583,21 @@ module.exports = (db, server, userHandler, settingsHandler) => { let userData; try { + + let unameview = '' + if(username.includes("@")){ + unameview = tools.normalizeAddress(username, false, { + removeLabel: true, + removeDots: true + }) + } + else{ + unameview = username.replace(/\./g, '') + } + userData = await db.users.collection('users').findOne( { - unameview: tools.normalizeAddress(username, false, { - removeLabel: true, - removeDots: true - }) + unameview }, { projection: {