Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7011048

Browse files
committed
Disable /register/available if registration is disabled (#6082)
2 parents ca70d6a + 1b519e0 commit 7011048

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog.d/6082.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Return 403 on `/register/available` if registration has been disabled.

synapse/rest/client/v2_alpha/register.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ def __init__(self, hs):
333333

334334
@defer.inlineCallbacks
335335
def on_GET(self, request):
336+
if not self.hs.config.enable_registration:
337+
raise SynapseError(
338+
403, "Registration has been disabled", errcode=Codes.FORBIDDEN
339+
)
340+
336341
ip = self.hs.get_ip_from_request(request)
337342
with self.ratelimiter.ratelimit(ip) as wait_deferred:
338343
yield wait_deferred

0 commit comments

Comments
 (0)