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/registerUser.coffee

22 lines
828 B

Meteor.methods
registerUser: (formData) ->
if RocketChat.settings.get('Accounts_RegistrationForm') is 'Disabled'
throw new Meteor.Error 'registration-disabled', 'User registration is disabled'
else if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL' and (not formData.secretURL or formData.secretURL isnt RocketChat.settings.get('Accounts_RegistrationForm_SecretURL'))
throw new Meteor.Error 'registration-disabled', 'User registration is only allowed via Secret URL'
RocketChat.validateEmailDomain(formData.email);
userData =
email: s.trim(formData.email)
password: formData.pass
userId = Accounts.createUser userData
RocketChat.models.Users.setName userId, s.trim(formData.name)
if userData.email
Accounts.sendVerificationEmail(userId, userData.email);
return userId