aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRowan Bohde <rowan.bohde@gmail.com>2024-08-19 12:58:53 -0500
committerGitHub <noreply@github.com>2024-08-19 17:58:53 +0000
commit0d24c9f383255605d68a92cc5f087c3f16a1d735 (patch)
tree581a31d251eafbceaeb30ba7bd92a3a864203fc0
parentccf7366db0b47e0720a61666acdaa6e6ab1e2273 (diff)
downloadgitea-0d24c9f383255605d68a92cc5f087c3f16a1d735.tar.gz
gitea-0d24c9f383255605d68a92cc5f087c3f16a1d735.zip
add CfTurnstileSitekey context data to all captcha templates (#31874)
In the OpenID flows, the "CfTurnstileSitekey" wasn't populated, which caused those flows to fail if using Turnstile as the Captcha implementation. This adds the missing context variables, allowing Turnstile to be used in the OpenID flows.
-rw-r--r--routers/web/auth/linkaccount.go3
-rw-r--r--routers/web/auth/openid.go1
2 files changed, 4 insertions, 0 deletions
diff --git a/routers/web/auth/linkaccount.go b/routers/web/auth/linkaccount.go
index 24130df634..519431d92b 100644
--- a/routers/web/auth/linkaccount.go
+++ b/routers/web/auth/linkaccount.go
@@ -40,6 +40,7 @@ func LinkAccount(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
ctx.Data["ShowRegistrationButton"] = false
@@ -132,6 +133,7 @@ func LinkAccountPostSignIn(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["ShowRegistrationButton"] = false
@@ -219,6 +221,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["ShowRegistrationButton"] = false
diff --git a/routers/web/auth/openid.go b/routers/web/auth/openid.go
index 2143b8096a..83268faacb 100644
--- a/routers/web/auth/openid.go
+++ b/routers/web/auth/openid.go
@@ -307,6 +307,7 @@ func RegisterOpenID(ctx *context.Context) {
ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["OpenID"] = oid
userName, _ := ctx.Session.Get("openid_determined_username").(string)
if userName != "" {