mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-07 22:31:56 +00:00
Fix errorcode for disabled registration (#8867)
The spec says we should return `M_FORBIDDEN` when someone tries to register and registration is disabled.
This commit is contained in:
parent
66f75c5b74
commit
cf3b8156be
1
changelog.d/8867.bugfix
Normal file
1
changelog.d/8867.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix the error code that is returned when a user tries to register on a homeserver on which new-user registration has been disabled.
|
@ -451,7 +451,7 @@ class RegisterRestServlet(RestServlet):
|
|||||||
|
|
||||||
# == Normal User Registration == (everyone else)
|
# == Normal User Registration == (everyone else)
|
||||||
if not self._registration_enabled:
|
if not self._registration_enabled:
|
||||||
raise SynapseError(403, "Registration has been disabled")
|
raise SynapseError(403, "Registration has been disabled", Codes.FORBIDDEN)
|
||||||
|
|
||||||
# For regular registration, convert the provided username to lowercase
|
# For regular registration, convert the provided username to lowercase
|
||||||
# before attempting to register it. This should mean that people who try
|
# before attempting to register it. This should mean that people who try
|
||||||
|
@ -121,6 +121,7 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase):
|
|||||||
|
|
||||||
self.assertEquals(channel.result["code"], b"403", channel.result)
|
self.assertEquals(channel.result["code"], b"403", channel.result)
|
||||||
self.assertEquals(channel.json_body["error"], "Registration has been disabled")
|
self.assertEquals(channel.json_body["error"], "Registration has been disabled")
|
||||||
|
self.assertEquals(channel.json_body["errcode"], "M_FORBIDDEN")
|
||||||
|
|
||||||
def test_POST_guest_registration(self):
|
def test_POST_guest_registration(self):
|
||||||
self.hs.config.macaroon_secret_key = "test"
|
self.hs.config.macaroon_secret_key = "test"
|
||||||
|
Loading…
Reference in New Issue
Block a user