mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	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. (cherry picked from commit 0d24c9f383255605d68a92cc5f087c3f16a1d735)
This commit is contained in:
		
					parent
					
						
							
								014367158f
							
						
					
				
			
			
				commit
				
					
						41281fc80a
					
				
			
		
					 2 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -40,6 +40,7 @@ func LinkAccount(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
						ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
						ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
						ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
				
			||||||
 | 
						ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
 | 
				
			||||||
	ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
						ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
				
			||||||
	ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
 | 
						ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
 | 
				
			||||||
	ctx.Data["ShowRegistrationButton"] = false
 | 
						ctx.Data["ShowRegistrationButton"] = false
 | 
				
			||||||
| 
						 | 
					@ -128,6 +129,7 @@ func LinkAccountPostSignIn(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
						ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
						ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
						ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
				
			||||||
 | 
						ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
 | 
				
			||||||
	ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
						ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
				
			||||||
	ctx.Data["ShowRegistrationButton"] = false
 | 
						ctx.Data["ShowRegistrationButton"] = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,6 +217,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
						ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
						ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
						ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
				
			||||||
 | 
						ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
 | 
				
			||||||
	ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
						ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
 | 
				
			||||||
	ctx.Data["ShowRegistrationButton"] = false
 | 
						ctx.Data["ShowRegistrationButton"] = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -307,6 +307,7 @@ func RegisterOpenID(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
 | 
						ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
 | 
				
			||||||
	ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
						ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
 | 
				
			||||||
	ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
						ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
 | 
				
			||||||
 | 
						ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
 | 
				
			||||||
	ctx.Data["OpenID"] = oid
 | 
						ctx.Data["OpenID"] = oid
 | 
				
			||||||
	userName, _ := ctx.Session.Get("openid_determined_username").(string)
 | 
						userName, _ := ctx.Session.Get("openid_determined_username").(string)
 | 
				
			||||||
	if userName != "" {
 | 
						if userName != "" {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue