diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-14 13:47:39 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-14 13:47:39 +0100 |
commit | 61933f8e5278fda03e34eb25b729dd6a3987b6ab (patch) | |
tree | 18723b3f6cebeecef31be925f66b9c97353d72aa /synapse | |
parent | BF: Use ng-src (diff) | |
download | synapse-61933f8e5278fda03e34eb25b729dd6a3987b6ab.tar.xz |
Added M_UNKNOWN_TOKEN error code and send it when there is an unrecognised access_token
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/api/auth.py | 5 | ||||
-rw-r--r-- | synapse/api/errors.py | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index 8d2ba242e1..31852b29a5 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -18,7 +18,7 @@ from twisted.internet import defer from synapse.api.constants import Membership -from synapse.api.errors import AuthError, StoreError +from synapse.api.errors import AuthError, StoreError, Codes from synapse.api.events.room import (RoomTopicEvent, RoomMemberEvent, MessageEvent, FeedbackEvent) @@ -163,4 +163,5 @@ class Auth(object): user_id = yield self.store.get_user_by_token(token=token) defer.returnValue(self.hs.parse_userid(user_id)) except StoreError: - raise AuthError(403, "Unrecognised access token.") + raise AuthError(403, "Unrecognised access token.", + errcode=Codes.UNKNOWN_TOKEN) diff --git a/synapse/api/errors.py b/synapse/api/errors.py index b5970c959b..21ededc5ae 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -27,6 +27,7 @@ class Codes(object): BAD_PAGINATION = "M_BAD_PAGINATION" UNKNOWN = "M_UNKNOWN" NOT_FOUND = "M_NOT_FOUND" + UNKNOWN_TOKEN = "M_UNKNOWN_TOKEN" class CodeMessageException(Exception): |