fix(usernames): don't supply username in public fields if unverified

This commit is contained in:
Sabe Jones
2018-11-01 15:32:40 -05:00
parent dc46127fc7
commit 6ab08a7d52
3 changed files with 7 additions and 1 deletions

View File

@@ -109,6 +109,8 @@ api.getMember = {
if (!member) throw new NotFound(res.t('userWithIDNotFound', {userId: memberId}));
if (!member.flags.verifiedUsername) delete member.auth.local.username;
// manually call toJSON with minimize: true so empty paths aren't returned
let memberToJSON = member.toJSON({minimize: true});
User.addComputedStatsToJSONObj(memberToJSON.stats, member);