summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-01-19 18:23:56 +0000
committerMatthew Hodgson <matthew@matrix.org>2018-01-19 18:23:56 +0000
commit62d7d66ae5592175bb35a2a8d2f69b1924d6e1f2 (patch)
tree352a9fef2d773e97a1cd156de788e5c6cd25e943 /synapse/rest/client
parentfix PR nitpicking (diff)
downloadsynapse-62d7d66ae5592175bb35a2a8d2f69b1924d6e1f2.tar.xz
oops, check all login types
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/register.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index bf68e34a58..4e73f9a40a 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -365,20 +365,17 @@ class RegisterRestServlet(RestServlet):
         # /register/email/requestToken when we requested a 3pid, but that's not
         # guaranteed.
 
-        if (
-            auth_result and
-            (
-                LoginType.EMAIL_IDENTITY in auth_result or
-                LoginType.EMAIL_MSISDN in auth_result
-            )
-        ):
-            medium = auth_result[LoginType.EMAIL_IDENTITY].threepid['medium']
-            address = auth_result[LoginType.EMAIL_IDENTITY].threepid['address']
-
-            if not check_3pid_allowed(self.hs, medium, address):
-                raise SynapseError(
-                    403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
-                )
+        if auth_result:
+            for login_type in [LoginType.EMAIL_IDENTITY, LoginType.EMAIL_MSISDN]:
+                if login_type in auth_result:
+                    medium = auth_result[login_type].threepid['medium']
+                    address = auth_result[login_type].threepid['address']
+
+                    if not check_3pid_allowed(self.hs, medium, address):
+                        raise SynapseError(
+                            403, "Third party identifier is not allowed",
+                            Codes.THREEPID_DENIED,
+                        )
 
         if registered_user_id is not None:
             logger.info(