Skip to content

Commit 0d24c9f

Browse files
authored
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.
1 parent ccf7366 commit 0d24c9f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: routers/web/auth/linkaccount.go

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func LinkAccount(ctx *context.Context) {
4040
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
4141
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
4242
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
43+
ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
4344
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
4445
ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
4546
ctx.Data["ShowRegistrationButton"] = false
@@ -132,6 +133,7 @@ func LinkAccountPostSignIn(ctx *context.Context) {
132133
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
133134
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
134135
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
136+
ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
135137
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
136138
ctx.Data["ShowRegistrationButton"] = false
137139

@@ -219,6 +221,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
219221
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
220222
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
221223
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
224+
ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
222225
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
223226
ctx.Data["ShowRegistrationButton"] = false
224227

Diff for: routers/web/auth/openid.go

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ func RegisterOpenID(ctx *context.Context) {
307307
ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
308308
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
309309
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
310+
ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
310311
ctx.Data["OpenID"] = oid
311312
userName, _ := ctx.Session.Get("openid_determined_username").(string)
312313
if userName != "" {

0 commit comments

Comments
 (0)