diff options
author | 6543 <6543@obermui.de> | 2021-05-09 16:13:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 16:13:35 +0200 |
commit | a229e3438780a18d283b21920c5ccd1670e5f747 (patch) | |
tree | fee51422c56b2c237b796ca5fd3ff004cdcd96b8 /modules/setting/service.go | |
parent | e818e9150f63b5e68ec3018c61c1fae98b1eb1ed (diff) | |
download | gitea-a229e3438780a18d283b21920c5ccd1670e5f747.tar.gz gitea-a229e3438780a18d283b21920c5ccd1670e5f747.zip |
Allow only internal registration (#15795)
* Add ALLOW_ONLY_INTERNAL_REGISTRATION into settings
* OpenID respect setting too
Diffstat (limited to 'modules/setting/service.go')
-rw-r--r-- | modules/setting/service.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/setting/service.go b/modules/setting/service.go index 9696e98641..41e834e8e6 100644 --- a/modules/setting/service.go +++ b/modules/setting/service.go @@ -23,6 +23,7 @@ var Service struct { EmailDomainWhitelist []string EmailDomainBlocklist []string DisableRegistration bool + AllowOnlyInternalRegistration bool AllowOnlyExternalRegistration bool ShowRegistrationButton bool ShowMilestonesDashboardPage bool @@ -73,7 +74,12 @@ func newService() { Service.ActiveCodeLives = sec.Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180) Service.ResetPwdCodeLives = sec.Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180) Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool() + Service.AllowOnlyInternalRegistration = sec.Key("ALLOW_ONLY_INTERNAL_REGISTRATION").MustBool() Service.AllowOnlyExternalRegistration = sec.Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").MustBool() + if Service.AllowOnlyExternalRegistration && Service.AllowOnlyInternalRegistration { + log.Warn("ALLOW_ONLY_INTERNAL_REGISTRATION and ALLOW_ONLY_EXTERNAL_REGISTRATION are true - disabling registration") + Service.DisableRegistration = true + } if !sec.Key("REGISTER_EMAIL_CONFIRM").MustBool() { Service.RegisterManualConfirm = sec.Key("REGISTER_MANUAL_CONFIRM").MustBool(false) } else { |