The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-api/server/helpers/getLoggedInUser.js

14 lines
450 B

import { Accounts } from 'meteor/accounts-base';
RocketChat.API.helperMethods.set('getLoggedInUser', function _getLoggedInUser() {
let user;
if (this.request.headers['x-auth-token'] && this.request.headers['x-user-id']) {
user = RocketChat.models.Users.findOne({
_id: this.request.headers['x-user-id'],
'services.resume.loginTokens.hashedToken': Accounts._hashLoginToken(this.request.headers['x-auth-token']),
});
}
return user;
});