summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 0a68341494..d957a629dc 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -127,11 +127,26 @@ class RegistrationStore(SQLBaseStore):
 
         try:
             if was_guest:
+                # Ensure that the guest user actually exists
+                # ``allow_none=False`` makes this raise an exception
+                # if the row isn't in the database.
+                self._simple_select_one_txn(
+                    txn,
+                    "users",
+                    keyvalues={
+                        "name": user_id,
+                        "is_guest": 1,
+                    },
+                    retcols=("name",),
+                    allow_none=False,
+                )
+
                 self._simple_update_one_txn(
                     txn,
                     "users",
                     keyvalues={
                         "name": user_id,
+                        "is_guest": 1,
                     },
                     updatevalues={
                         "password_hash": password_hash,