summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-11-13 17:26:59 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-11-13 17:26:59 +0000
commit4fbe6ca4010f804d784e16255fe4c63b7f607c52 (patch)
tree6a483ad84dae70964241b918b98d2525038f2fb2 /synapse/storage/registration.py
parentMerge branch 'develop' into paul/tiny-fixes (diff)
parentMerge pull request #374 from matrix-org/daniel/guestleave (diff)
downloadsynapse-4fbe6ca4010f804d784e16255fe4c63b7f607c52.tar.xz
Merge branch 'develop' into paul/tiny-fixes
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index b454dd5b3a..2e5eddd259 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -102,13 +102,14 @@ class RegistrationStore(SQLBaseStore):
                 400, "User ID already taken.", errcode=Codes.USER_IN_USE
             )
 
-        # it's possible for this to get a conflict, but only for a single user
-        # since tokens are namespaced based on their user ID
-        txn.execute(
-            "INSERT INTO access_tokens(id, user_id, token)"
-            " VALUES (?,?,?)",
-            (next_id, user_id, token,)
-        )
+        if token:
+            # it's possible for this to get a conflict, but only for a single user
+            # since tokens are namespaced based on their user ID
+            txn.execute(
+                "INSERT INTO access_tokens(id, user_id, token)"
+                " VALUES (?,?,?)",
+                (next_id, user_id, token,)
+            )
 
     def get_user_by_id(self, user_id):
         return self._simple_select_one(