summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha/account.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2021-01-05 11:32:29 +0000
committerRichard van der Hoff <richard@matrix.org>2021-01-05 11:32:29 +0000
commit97d12dcf56f6a50d53c80b5d9a69fa66d175c05e (patch)
tree5d0d91e8b737f2b0ba8d691e9efd83ace71d7cb7 /synapse/rest/client/v2_alpha/account.py
parentAllow redacting events on workers (#8994) (diff)
parentAdd type hints to the receipts and user directory handlers. (#8976) (diff)
downloadsynapse-97d12dcf56f6a50d53c80b5d9a69fa66d175c05e.tar.xz
Merge remote-tracking branch 'origin/release-v1.25.0' into matrix-org-hotfixes
Diffstat (limited to 'synapse/rest/client/v2_alpha/account.py')
-rw-r--r--synapse/rest/client/v2_alpha/account.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/account.py b/synapse/rest/client/v2_alpha/account.py

index eebee44a44..d837bde1d6 100644 --- a/synapse/rest/client/v2_alpha/account.py +++ b/synapse/rest/client/v2_alpha/account.py
@@ -254,14 +254,18 @@ class PasswordRestServlet(RestServlet): logger.error("Auth succeeded but no known type! %r", result.keys()) raise SynapseError(500, "", Codes.UNKNOWN) - # If we have a password in this request, prefer it. Otherwise, there - # must be a password hash from an earlier request. + # If we have a password in this request, prefer it. Otherwise, use the + # password hash from an earlier request. if new_password: password_hash = await self.auth_handler.hash(new_password) - else: + elif session_id is not None: password_hash = await self.auth_handler.get_session_data( session_id, "password_hash", None ) + else: + # UI validation was skipped, but the request did not include a new + # password. + password_hash = None if not password_hash: raise SynapseError(400, "Missing params: password", Codes.MISSING_PARAM)