summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-05 17:58:06 -0700
committerKegan Dougal <kegan@matrix.org>2014-09-05 17:58:06 -0700
commit0b9e1e7b562c3b278873060ca3c4109bc2e451e8 (patch)
tree9b20a68e0ecb72acbfd963ad2510eec3387ac3c6 /synapse/rest
parentAdded webclient config.js for storing recaptcha public key. (diff)
downloadsynapse-0b9e1e7b562c3b278873060ca3c4109bc2e451e8.tar.xz
Added a captcha config to the HS, to enable registration captcha checking and for the recaptcha private key.
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/register.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/rest/register.py b/synapse/rest/register.py
index b8de3b250d..33a80b7a77 100644
--- a/synapse/rest/register.py
+++ b/synapse/rest/register.py
@@ -16,7 +16,7 @@
 """This module contains REST servlets to do with registration: /register"""
 from twisted.internet import defer
 
-from synapse.api.errors import SynapseError
+from synapse.api.errors import SynapseError, Codes
 from base import RestServlet, client_path_pattern
 
 import json
@@ -50,6 +50,10 @@ class RegisterRestServlet(RestServlet):
         threepidCreds = None
         if 'threepidCreds' in register_json:
             threepidCreds = register_json['threepidCreds']
+            
+        if self.hs.config.enable_registration_captcha:
+            if not "challenge" in register_json or not "response" in register_json:
+                raise SynapseError(400, "Captcha response is required", errcode=Codes.NEEDS_CAPTCHA)
 
         handler = self.handlers.registration_handler
         (user_id, token) = yield handler.register(