summary refs log tree commit diff
path: root/synapse/rest/admin
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-01-20 17:38:21 +0000
committerGitHub <noreply@github.com>2020-01-20 17:38:21 +0000
commitb0a66ab83ce4d67e145a1129b1ebd8fc53c24408 (patch)
treee92fe5cc41128b369e096f2e34c7bae0e369803e /synapse/rest/admin
parentFix `/events/:event_id` deprecated API. (#6731) (diff)
downloadsynapse-b0a66ab83ce4d67e145a1129b1ebd8fc53c24408.tar.xz
Fixup synapse.rest to pass mypy (#6732)
Diffstat (limited to 'synapse/rest/admin')
-rw-r--r--synapse/rest/admin/users.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py
index c178c960c5..52d27fa3e3 100644
--- a/synapse/rest/admin/users.py
+++ b/synapse/rest/admin/users.py
@@ -338,21 +338,22 @@ class UserRegisterServlet(RestServlet):
 
         got_mac = body["mac"]
 
-        want_mac = hmac.new(
+        want_mac_builder = hmac.new(
             key=self.hs.config.registration_shared_secret.encode(),
             digestmod=hashlib.sha1,
         )
-        want_mac.update(nonce.encode("utf8"))
-        want_mac.update(b"\x00")
-        want_mac.update(username)
-        want_mac.update(b"\x00")
-        want_mac.update(password)
-        want_mac.update(b"\x00")
-        want_mac.update(b"admin" if admin else b"notadmin")
+        want_mac_builder.update(nonce.encode("utf8"))
+        want_mac_builder.update(b"\x00")
+        want_mac_builder.update(username)
+        want_mac_builder.update(b"\x00")
+        want_mac_builder.update(password)
+        want_mac_builder.update(b"\x00")
+        want_mac_builder.update(b"admin" if admin else b"notadmin")
         if user_type:
-            want_mac.update(b"\x00")
-            want_mac.update(user_type.encode("utf8"))
-        want_mac = want_mac.hexdigest()
+            want_mac_builder.update(b"\x00")
+            want_mac_builder.update(user_type.encode("utf8"))
+
+        want_mac = want_mac_builder.hexdigest()
 
         if not hmac.compare_digest(want_mac.encode("ascii"), got_mac.encode("ascii")):
             raise SynapseError(403, "HMAC incorrect")