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.js

31 lines
732 B

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