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/server/methods/setAvatarFromService.coffee

22 lines
676 B

Meteor.methods
setAvatarFromService: (dataURI, contentType, service) ->
check dataURI, String
check contentType, Match.Optional(String)
check service, Match.Optional(String)
unless Meteor.userId()
throw new Meteor.Error('error-invalid-user', "Invalid user", { method: 'setAvatarFromService' })
unless RocketChat.settings.get("Accounts_AllowUserAvatarChange")
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'setAvatarFromService' });
user = Meteor.user()
return RocketChat.setUserAvatar(user, dataURI, contentType, service);
DDPRateLimiter.addRule
type: 'method'
name: 'setAvatarFromService'
userId: -> return true
, 1, 5000