Disable /register/available if registration is disabled (#6082)
This commit is contained in:
1
changelog.d/6082.feature
Normal file
1
changelog.d/6082.feature
Normal file
@@ -0,0 +1 @@
|
||||
Return 403 on `/register/available` if registration has been disabled.
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user