1
0

Disable /register/available if registration is disabled (#6082)

This commit is contained in:
Andrew Morgan
2020-02-25 15:21:39 +00:00
2 changed files with 6 additions and 0 deletions

1
changelog.d/6082.feature Normal file
View File

@@ -0,0 +1 @@
Return 403 on `/register/available` if registration has been disabled.

View File

@@ -333,6 +333,11 @@ class UsernameAvailabilityRestServlet(RestServlet):
@defer.inlineCallbacks
def on_GET(self, request):
if not self.hs.config.enable_registration:
raise SynapseError(
403, "Registration has been disabled", errcode=Codes.FORBIDDEN
)
ip = self.hs.get_ip_from_request(request)
with self.ratelimiter.ratelimit(ip) as wait_deferred:
yield wait_deferred