From 8e5447a3b3151f7fc12d90d021d14429907708ea Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 29 Aug 2024 12:56:32 +0100 Subject: [PATCH] Send M_TOKEN_INCORRECT as per MSC4183 --- sydent/http/servlets/emailservlet.py | 5 +++-- sydent/http/servlets/msisdnservlet.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sydent/http/servlets/emailservlet.py b/sydent/http/servlets/emailservlet.py index 6e60f17c..70fe061e 100644 --- a/sydent/http/servlets/emailservlet.py +++ b/sydent/http/servlets/emailservlet.py @@ -220,10 +220,11 @@ def do_validate_request(self, request: Request) -> JsonDict: "error": "The token doesn't match", } except IncorrectSessionTokenException: + request.setResponseCode(400) return { "success": False, - "errcode": "M_NO_VALID_SESSION", - "error": "No session could be found with this sid", + "errcode": "M_TOKEN_INCORRECT", + "error": "The token supplied is incorrect", } def render_OPTIONS(self, request: Request) -> bytes: diff --git a/sydent/http/servlets/msisdnservlet.py b/sydent/http/servlets/msisdnservlet.py index 7ddd7e71..e87e5e22 100644 --- a/sydent/http/servlets/msisdnservlet.py +++ b/sydent/http/servlets/msisdnservlet.py @@ -251,11 +251,11 @@ def do_validate_request(self, request: Request) -> JsonDict: "error": "The token doesn't match", } except IncorrectSessionTokenException: - request.setResponseCode(404) + request.setResponseCode(400) return { "success": False, - "errcode": "M_NO_VALID_SESSION", - "error": "No session could be found with this sid", + "errcode": "M_TOKEN_INCORRECT", + "error": "The token supplied is incorrect", } def render_OPTIONS(self, request: Request) -> bytes: