summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn0emis <22817873+n0emis@users.noreply.github.com>2020-04-29 23:46:43 +0200
committerGitHub <noreply@github.com>2020-04-29 22:46:43 +0100
commit33738ff91b9e9b87b10e1fb715cf855007770002 (patch)
tree7c1e70a152a331c2e6961726f4e3c69d956c78ca
parent1bf9e44bda5c8cd1fd72622cffce8ec291db79c5 (diff)
downloadgitea-33738ff91b9e9b87b10e1fb715cf855007770002.tar.gz
gitea-33738ff91b9e9b87b10e1fb715cf855007770002.zip
Don't allow registration via the web form, when AllowOnlyExternalRegistration is True (#11248)
* Don't allow registration via the web form, when AllowOnlyExternalRegistration is True * Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
-rw-r--r--routers/user/auth.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 9d242bcfc2..169f3c453d 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -1021,7 +1021,8 @@ func SignUp(ctx *context.Context) {
ctx.Data["CaptchaType"] = setting.Service.CaptchaType
ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
- ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
+ //Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
+ ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration
ctx.HTML(200, tplSignUp)
}
@@ -1038,7 +1039,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
//Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
- if setting.Service.DisableRegistration {
+ if setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration {
ctx.Error(403)
return
}