From c1ac29128494df9b8ad9e1d25166ce340eed8014 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 8 Nov 2021 15:36:37 -0500 Subject: [PATCH] fix: ability to enumerate email via updateProfile method --- src/user/profile.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/user/profile.js b/src/user/profile.js index 2748690b81..a8d1b02d1d 100644 --- a/src/user/profile.js +++ b/src/user/profile.js @@ -71,7 +71,7 @@ module.exports = function (User) { }; async function validateData(callerUid, data) { - await isEmailAvailable(data, data.uid); + await isEmailValid(data); await isUsernameAvailable(data, data.uid); await isWebsiteValid(callerUid, data); await isAboutMeValid(callerUid, data); @@ -82,7 +82,7 @@ module.exports = function (User) { isGroupTitleValid(data); } - async function isEmailAvailable(data, uid) { + async function isEmailValid(data) { if (!data.email) { return; } @@ -91,14 +91,6 @@ module.exports = function (User) { if (!utils.isEmailValid(data.email)) { throw new Error('[[error:invalid-email]]'); } - const email = await User.getUserField(uid, 'email'); - if (email === data.email) { - return; - } - const available = await User.email.available(data.email); - if (!available) { - throw new Error('[[error:email-taken]]'); - } } async function isUsernameAvailable(data, uid) {