mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 05:29:22 -05:00
Send down correct error response if user not found
This commit is contained in:
parent
209ba4d024
commit
cc84f7cb8e
@ -18,7 +18,7 @@ from twisted.internet import defer
|
|||||||
from ._base import BaseHandler
|
from ._base import BaseHandler
|
||||||
from synapse.api.constants import LoginType
|
from synapse.api.constants import LoginType
|
||||||
from synapse.types import UserID
|
from synapse.types import UserID
|
||||||
from synapse.api.errors import AuthError, LoginError, Codes
|
from synapse.api.errors import AuthError, LoginError, Codes, StoreError, SynapseError
|
||||||
from synapse.util.async import run_on_reactor
|
from synapse.util.async import run_on_reactor
|
||||||
|
|
||||||
from twisted.web.client import PartialDownloadError
|
from twisted.web.client import PartialDownloadError
|
||||||
@ -563,7 +563,12 @@ class AuthHandler(BaseHandler):
|
|||||||
|
|
||||||
except_access_token_ids = [requester.access_token_id] if requester else []
|
except_access_token_ids = [requester.access_token_id] if requester else []
|
||||||
|
|
||||||
yield self.store.user_set_password_hash(user_id, password_hash)
|
try:
|
||||||
|
yield self.store.user_set_password_hash(user_id, password_hash)
|
||||||
|
except StoreError as e:
|
||||||
|
if e.code == 404:
|
||||||
|
raise SynapseError(404, "Unknown user", Codes.NOT_FOUND)
|
||||||
|
raise e
|
||||||
yield self.store.user_delete_access_tokens(
|
yield self.store.user_delete_access_tokens(
|
||||||
user_id, except_access_token_ids
|
user_id, except_access_token_ids
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user