+
diff --git a/server/methods/registerUser.coffee b/server/methods/registerUser.coffee
index 08513c97b3a2..d441143015d1 100644
--- a/server/methods/registerUser.coffee
+++ b/server/methods/registerUser.coffee
@@ -3,6 +3,9 @@ Meteor.methods
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'
+
userData =
email: formData.email
password: formData.pass