fix(emails): dont allow retrieving user data if showemail is false @julianlam

This commit is contained in:
Barış Soner Uşaklı
2021-07-05 14:00:48 -04:00
committed by Julian Lam
parent 6694bdd550
commit 7d115c8ef2

View File

@@ -46,6 +46,12 @@ userController.getUserDataByField = async function (callerUid, field, fieldValue
uid = await user.getUidByUsername(fieldValue); uid = await user.getUidByUsername(fieldValue);
} else if (field === 'email') { } else if (field === 'email') {
uid = await user.getUidByEmail(fieldValue); uid = await user.getUidByEmail(fieldValue);
if (uid) {
const settings = await user.getSettings(uid);
if (settings && !settings.showemail) {
uid = 0;
}
}
} }
if (!uid) { if (!uid) {
return null; return null;