Skip to content

Commit

Permalink
Merge pull request #9183 from RocketChat/fix/api-me-only-return-verified
Browse files Browse the repository at this point in the history
Fix/api me only return verified
# Conflicts:
#	packages/rocketchat-api/server/v1/misc.js
  • Loading branch information
rodrigok committed Dec 20, 2017
1 parent 2c5da35 commit a013e68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/rocketchat-api/server/v1/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RocketChat.API.v1.addRoute('info', { authRequired: false }, {

RocketChat.API.v1.addRoute('me', { authRequired: true }, {
get() {
return RocketChat.API.v1.success(_.pick(this.user, [
const me = RocketChat.API.v1.success(_.pick(this.user, [
'_id',
'name',
'emails',
Expand All @@ -31,6 +31,12 @@ RocketChat.API.v1.addRoute('me', { authRequired: true }, {
'active',
'language'
]));

const verifiedEmail = me.emails.find((email) => email.verified);

me.email = verifiedEmail ? verifiedEmail.address : undefined;

return RocketChat.API.v1.success(me);
}
});

Expand Down

0 comments on commit a013e68

Please sign in to comment.