Disable registration if config option was set.

This commit is contained in:
Erik Johnston 2015-02-19 14:22:20 +00:00
parent 81163f822e
commit 0722f982d3
1 changed files with 4 additions and 0 deletions

View File

@ -59,6 +59,7 @@ class RegisterRestServlet(ClientV1RestServlet):
# } # }
# TODO: persistent storage # TODO: persistent storage
self.sessions = {} self.sessions = {}
self.disable_registration = hs.config.disable_registration
def on_GET(self, request): def on_GET(self, request):
if self.hs.config.enable_registration_captcha: if self.hs.config.enable_registration_captcha:
@ -97,6 +98,9 @@ class RegisterRestServlet(ClientV1RestServlet):
@defer.inlineCallbacks @defer.inlineCallbacks
def on_POST(self, request): def on_POST(self, request):
if self.disable_registration:
raise SynapseError(403, "Registration has been disabled")
register_json = _parse_json(request) register_json = _parse_json(request)
session = (register_json["session"] session = (register_json["session"]