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

Disable /register/available if registration is disabled #6082

Merged
merged 2 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6082.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return 403 on `/register/available` if registration has been disabled.
5 changes: 5 additions & 0 deletions synapse/rest/client/v2_alpha/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ def __init__(self, hs):

@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
Expand Down