diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-02-18 10:12:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-18 10:12:26 +0000 |
commit | e1eb5807b66940490291983be905f2849539aa7f (patch) | |
tree | dd8ebe07f55ab9027ec413ea4554e8217252da8c /clientapi | |
parent | 5dd203fde3d3b86719354245ac341dbf67fa1851 (diff) |
Allow preventing guest registration (#2199)
* Allow disabling guest registration separately
* Update sample config
* Set `guests_disabled` to `true` in the sample config
Diffstat (limited to 'clientapi')
-rw-r--r-- | clientapi/routing/register.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index fc275a5d..f73cc662 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -532,6 +532,13 @@ func handleGuestRegistration( cfg *config.ClientAPI, userAPI userapi.UserInternalAPI, ) util.JSONResponse { + if cfg.RegistrationDisabled || cfg.GuestsDisabled { + return util.JSONResponse{ + Code: http.StatusForbidden, + JSON: jsonerror.Forbidden("Guest registration is disabled"), + } + } + var res userapi.PerformAccountCreationResponse err := userAPI.PerformAccountCreation(req.Context(), &userapi.PerformAccountCreationRequest{ AccountType: userapi.AccountTypeGuest, |