mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Allow disabling guest registration separately
This commit is contained in:
parent
5dd203fde3
commit
4d5843bba6
|
|
@ -532,6 +532,13 @@ func handleGuestRegistration(
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
userAPI userapi.UserInternalAPI,
|
userAPI userapi.UserInternalAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
|
if cfg.RegistrationDisabled || cfg.GuestsDisabled {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusForbidden,
|
||||||
|
JSON: jsonerror.Forbidden("Guest registration is disabled"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var res userapi.PerformAccountCreationResponse
|
var res userapi.PerformAccountCreationResponse
|
||||||
err := userAPI.PerformAccountCreation(req.Context(), &userapi.PerformAccountCreationRequest{
|
err := userAPI.PerformAccountCreation(req.Context(), &userapi.PerformAccountCreationRequest{
|
||||||
AccountType: userapi.AccountTypeGuest,
|
AccountType: userapi.AccountTypeGuest,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ type ClientAPI struct {
|
||||||
// If set, allows registration by anyone who also has the shared
|
// If set, allows registration by anyone who also has the shared
|
||||||
// secret, even if registration is otherwise disabled.
|
// secret, even if registration is otherwise disabled.
|
||||||
RegistrationSharedSecret string `yaml:"registration_shared_secret"`
|
RegistrationSharedSecret string `yaml:"registration_shared_secret"`
|
||||||
|
// If set, prevents guest accounts from being created. Only takes
|
||||||
|
// effect if registration is enabled, otherwise guests registration
|
||||||
|
// is forbidden either way.
|
||||||
|
GuestsDisabled bool `yaml:"guests_disabled"`
|
||||||
|
|
||||||
// Boolean stating whether catpcha registration is enabled
|
// Boolean stating whether catpcha registration is enabled
|
||||||
// and required
|
// and required
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue