summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-22 09:57:06 +0100
committerErik Johnston <erik@matrix.org>2020-10-22 09:57:06 +0100
commitab4cd7f8026838d57ff36642abd1724fe766f2af (patch)
treedb4d66c27381903c3c0e75f16b372ac61a9b711e /synapse/handlers/auth.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentOptimise CacheDescriptor (#8594) (diff)
downloadsynapse-ab4cd7f8026838d57ff36642abd1724fe766f2af.tar.xz
Merge remote-tracking branch 'origin/release-v1.21.3' into matrix-org-hotfixes
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r--synapse/handlers/auth.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py

index 1d1ddc2245..8619fbb982 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py
@@ -1122,20 +1122,22 @@ class AuthHandler(BaseHandler): Whether self.hash(password) == stored_hash. """ - def _do_validate_hash(): + def _do_validate_hash(checked_hash: bytes): # Normalise the Unicode in the password pw = unicodedata.normalize("NFKC", password) return bcrypt.checkpw( pw.encode("utf8") + self.hs.config.password_pepper.encode("utf8"), - stored_hash, + checked_hash, ) if stored_hash: if not isinstance(stored_hash, bytes): stored_hash = stored_hash.encode("ascii") - return await defer_to_thread(self.hs.get_reactor(), _do_validate_hash) + return await defer_to_thread( + self.hs.get_reactor(), _do_validate_hash, stored_hash + ) else: return False