diff options
author | David Baker <dave@matrix.org> | 2015-04-15 17:14:25 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2015-04-15 17:14:25 +0100 |
commit | 766bd8e88077cbeabffc353d9735a3af190abe61 (patch) | |
tree | 0a45dbf99c1ae64d736ac640e45d3aad9ffde83d /synapse/rest/client | |
parent | Regstration with email in v2 (diff) | |
download | synapse-766bd8e88077cbeabffc353d9735a3af190abe61.tar.xz |
Dummy login so we can do the first POST request to get login flows without it just succeeding
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v2_alpha/register.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index d7a20fc964..ee99b74fd6 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -63,6 +63,17 @@ class RegisterRestServlet(RestServlet): if 'access_token' in request.args: service = yield self.auth.get_appservice_by_req(request) + if self.hs.config.enable_registration_captcha: + flows = [ + [LoginType.RECAPTCHA], + [LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA] + ] + else: + flows = [ + [LoginType.DUMMY], + [LoginType.EMAIL_IDENTITY] + ] + if service: is_application_server = True elif 'mac' in body: @@ -74,10 +85,9 @@ class RegisterRestServlet(RestServlet): ) is_using_shared_secret = True else: - authed, result, params = yield self.auth_handler.check_auth([ - [LoginType.RECAPTCHA], - [LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA], - ], body, self.hs.get_ip_from_request(request)) + authed, result, params = yield self.auth_handler.check_auth( + flows, body, self.hs.get_ip_from_request(request) + ) if not authed: defer.returnValue((401, result)) |