summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-31 10:49:14 +0100
committerNeil Johnson <neil@matrix.org>2018-08-31 10:49:14 +0100
commitea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da (patch)
tree149068aa0096858c2ad9ff661da4b5108f3a8f98 /synapse/rest
parentPort storage/ to Python 3 (#3725) (diff)
downloadsynapse-ea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da.tar.xz
fix bug where preserved threepid user comes to sign up and server is mau blocked
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1_only/register.py6
-rw-r--r--synapse/rest/client/v2_alpha/register.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/synapse/rest/client/v1_only/register.py b/synapse/rest/client/v1_only/register.py
index 5e99cffbcb..2c7bbcb171 100644
--- a/synapse/rest/client/v1_only/register.py
+++ b/synapse/rest/client/v1_only/register.py
@@ -281,11 +281,15 @@ class RegisterRestServlet(ClientV1RestServlet):
             register_json["user"].encode("utf-8")
             if "user" in register_json else None
         )
+        threepid = None
+        if session[LoginType.EMAIL_IDENTITY]:
+            threepid = session["threepidCreds"]
 
         handler = self.handlers.registration_handler
         (user_id, token) = yield handler.register(
             localpart=desired_user_id,
-            password=password
+            password=password,
+            threepid=threepid,
         )
 
         if session[LoginType.EMAIL_IDENTITY]:
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index 2f64155d13..45113e5386 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -395,11 +395,16 @@ class RegisterRestServlet(RestServlet):
             if desired_username is not None:
                 desired_username = desired_username.lower()
 
+            threepid = None
+            if auth_result:
+                threepid = auth_result.get(LoginType.EMAIL_IDENTITY)
+
             (registered_user_id, _) = yield self.registration_handler.register(
                 localpart=desired_username,
                 password=new_password,
                 guest_access_token=guest_access_token,
                 generate_token=False,
+                threepid=threepid,
             )
 
             # remember that we've now registered that user account, and with