Skip to content

Commit

Permalink
Don't allow registration via the web form, when AllowOnlyExternalReg…
Browse files Browse the repository at this point in the history
…istration 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
  • Loading branch information
n0emis authored Apr 29, 2020
1 parent 1bf9e44 commit 33738ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions routers/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand Down

0 comments on commit 33738ff

Please sign in to comment.