From 592cdf73be50af837d8c255ebcb5fbcd429c2954 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 20 Aug 2020 10:39:41 -0400 Subject: [PATCH] Improve the error code when trying to register using a name reserved for guests. (#8135) --- changelog.d/8135.bugfix | 1 + synapse/handlers/register.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/8135.bugfix diff --git a/changelog.d/8135.bugfix b/changelog.d/8135.bugfix new file mode 100644 index 0000000000..9d5c60ea00 --- /dev/null +++ b/changelog.d/8135.bugfix @@ -0,0 +1 @@ +Clarify the error code if a user tries to register with a numeric ID. This bug was introduced in v1.15.0. diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 999bc6efb5..ccd96e4626 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -124,7 +124,9 @@ class RegistrationHandler(BaseHandler): try: int(localpart) raise SynapseError( - 400, "Numeric user IDs are reserved for guest users." + 400, + "Numeric user IDs are reserved for guest users.", + errcode=Codes.INVALID_USERNAME, ) except ValueError: pass