summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-19 14:22:20 +0000
committerErik Johnston <erik@matrix.org>2015-02-19 14:22:20 +0000
commit0722f982d3b664e6e1c20c3853bb3742683aee88 (patch)
treefe31535fd1ea745c16f2cb8782f4ec4ed131e690 /synapse/rest/client
parentAdd config option to disable registration. (diff)
downloadsynapse-0722f982d3b664e6e1c20c3853bb3742683aee88.tar.xz
Disable registration if config option was set.
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v1/register.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/register.py b/synapse/rest/client/v1/register.py
index 8d2115082b..dba49129a9 100644
--- a/synapse/rest/client/v1/register.py
+++ b/synapse/rest/client/v1/register.py
@@ -59,6 +59,7 @@ class RegisterRestServlet(ClientV1RestServlet):
         # }
         # TODO: persistent storage
         self.sessions = {}
+        self.disable_registration = hs.config.disable_registration
 
     def on_GET(self, request):
         if self.hs.config.enable_registration_captcha:
@@ -97,6 +98,9 @@ class RegisterRestServlet(ClientV1RestServlet):
 
     @defer.inlineCallbacks
     def on_POST(self, request):
+        if self.disable_registration:
+            raise SynapseError(403, "Registration has been disabled")
+
         register_json = _parse_json(request)
 
         session = (register_json["session"]