summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorFabioFortini <FabioFortini@users.noreply.github.com>2018-05-13 09:51:16 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2018-05-13 15:51:16 +0800
commit1546458f7df4a4f0e77b7ae5cb65baed6feae394 (patch)
treeaae745f69c31c4b9b808f901ca6dcc0fbd47857a /routers
parente74055878f21c35e49faf2d17abb05e03bfe32e8 (diff)
downloadgitea-1546458f7df4a4f0e77b7ae5cb65baed6feae394.tar.gz
gitea-1546458f7df4a4f0e77b7ae5cb65baed6feae394.zip
issue-2768: added new option allow_only_external_registration (#3910)
Diffstat (limited to 'routers')
-rw-r--r--routers/install.go2
-rw-r--r--routers/user/auth.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/routers/install.go b/routers/install.go
index 2a7ec93d21..84e506c70b 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -112,6 +112,7 @@ func Install(ctx *context.Context) {
form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn
form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp
form.DisableRegistration = setting.Service.DisableRegistration
+ form.AllowOnlyExternalRegistration = setting.Service.AllowOnlyExternalRegistration
form.EnableCaptcha = setting.Service.EnableCaptcha
form.RequireSignInView = setting.Service.RequireSignInView
form.DefaultKeepEmailPrivate = setting.Service.DefaultKeepEmailPrivate
@@ -304,6 +305,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
cfg.Section("openid").Key("ENABLE_OPENID_SIGNIN").SetValue(com.ToStr(form.EnableOpenIDSignIn))
cfg.Section("openid").Key("ENABLE_OPENID_SIGNUP").SetValue(com.ToStr(form.EnableOpenIDSignUp))
cfg.Section("service").Key("DISABLE_REGISTRATION").SetValue(com.ToStr(form.DisableRegistration))
+ cfg.Section("service").Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").SetValue(com.ToStr(form.AllowOnlyExternalRegistration))
cfg.Section("service").Key("ENABLE_CAPTCHA").SetValue(com.ToStr(form.EnableCaptcha))
cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").SetValue(com.ToStr(form.RequireSignInView))
cfg.Section("service").Key("DEFAULT_KEEP_EMAIL_PRIVATE").SetValue(com.ToStr(form.DefaultKeepEmailPrivate))
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 2a5cb8e4b2..c8e1ada0db 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -741,7 +741,8 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
- if setting.Service.DisableRegistration {
+ //Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
+ if !setting.Service.ShowRegistrationButton {
ctx.Error(403)
return
}