summaryrefslogtreecommitdiffstats
path: root/routers/user/auth.go
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-11-09 06:42:34 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2019-11-09 17:42:34 +0800
commitf4937879b0f85e102bfe658ff75f09e6a5103ff9 (patch)
treeeb03aba4930274a4f4e25b1f6dd53f80d1d25a18 /routers/user/auth.go
parentc15d371939330f3b7d0e0aeaca3116a7b1c15065 (diff)
downloadgitea-f4937879b0f85e102bfe658ff75f09e6a5103ff9.tar.gz
gitea-f4937879b0f85e102bfe658ff75f09e6a5103ff9.zip
Fix require external registration password (#8885)
* Fix require external registration password * Fix ctx on error condition by @jolheiser
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r--routers/user/auth.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index b328ac094e..cb5611e045 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -707,7 +707,7 @@ func oAuth2UserLoginCallback(loginSource *models.LoginSource, request *http.Requ
// LinkAccount shows the page where the user can decide to login or create a new account
func LinkAccount(ctx *context.Context) {
- ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationCaptcha || setting.Service.AllowOnlyExternalRegistration
+ ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationPassword || setting.Service.AllowOnlyExternalRegistration
ctx.Data["Title"] = ctx.Tr("link_account")
ctx.Data["LinkAccountMode"] = true
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha && setting.Service.RequireExternalRegistrationCaptcha
@@ -757,7 +757,7 @@ func LinkAccount(ctx *context.Context) {
// LinkAccountPostSignIn handle the coupling of external account with another account using signIn
func LinkAccountPostSignIn(ctx *context.Context, signInForm auth.SignInForm) {
- ctx.Data["DisablePassword"] = setting.Service.AllowOnlyExternalRegistration
+ ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationPassword || setting.Service.AllowOnlyExternalRegistration
ctx.Data["Title"] = ctx.Tr("link_account")
ctx.Data["LinkAccountMode"] = true
ctx.Data["LinkAccountModeSignIn"] = true
@@ -840,7 +840,7 @@ func LinkAccountPostSignIn(ctx *context.Context, signInForm auth.SignInForm) {
func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
// TODO Make insecure passwords optional for local accounts also,
// once email-based Second-Factor Auth is available
- ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationCaptcha || setting.Service.AllowOnlyExternalRegistration
+ ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationPassword || setting.Service.AllowOnlyExternalRegistration
ctx.Data["Title"] = ctx.Tr("link_account")
ctx.Data["LinkAccountMode"] = true
ctx.Data["LinkAccountModeRegister"] = true