summary refs log tree commit diff
path: root/synapse/rest/admin/users.py
diff options
context:
space:
mode:
authorJan Christian Grünhage <jan.christian@gruenhage.xyz>2022-06-06 13:10:13 +0200
committerGitHub <noreply@github.com>2022-06-06 12:10:13 +0100
commitfcd8703508ce5bfe481fc2f1510b05731477ce32 (patch)
tree47180b0b22960d9bcf0e1daa4b92c26b8062ef36 /synapse/rest/admin/users.py
parentReduce the amount of state we pull from the DB (#12811) (diff)
downloadsynapse-fcd8703508ce5bfe481fc2f1510b05731477ce32.tar.xz
Allow updating passwords using the admin api without logging out devices (#12952)
Diffstat (limited to 'synapse/rest/admin/users.py')
-rw-r--r--synapse/rest/admin/users.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py
index 8e29ada8a0..f0614a2897 100644
--- a/synapse/rest/admin/users.py
+++ b/synapse/rest/admin/users.py
@@ -226,6 +226,13 @@ class UserRestServletV2(RestServlet):
             if not isinstance(password, str) or len(password) > 512:
                 raise SynapseError(HTTPStatus.BAD_REQUEST, "Invalid password")
 
+        logout_devices = body.get("logout_devices", True)
+        if not isinstance(logout_devices, bool):
+            raise SynapseError(
+                HTTPStatus.BAD_REQUEST,
+                "'logout_devices' parameter is not of type boolean",
+            )
+
         deactivate = body.get("deactivated", False)
         if not isinstance(deactivate, bool):
             raise SynapseError(
@@ -305,7 +312,6 @@ class UserRestServletV2(RestServlet):
                     await self.store.set_server_admin(target_user, set_admin_to)
 
             if password is not None:
-                logout_devices = True
                 new_password_hash = await self.auth_handler.hash(password)
 
                 await self.set_password_handler.set_password(