mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Add option to enable CAPTCHA validation for login (#21638)
Enable this to require captcha validation for user login. You also must enable `ENABLE_CAPTCHA`. Summary: - Consolidate CAPTCHA template - add CAPTCHA handle and context - add `REQUIRE_CAPTCHA_FOR_LOGIN` config and docs - Consolidate CAPTCHA set-up and verification code Partially resolved #6049 Signed-off-by: Xinyu Zhou <i@sourcehut.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -40,6 +40,7 @@ var Service = struct {
 | 
			
		||||
	EnableReverseProxyEmail                 bool
 | 
			
		||||
	EnableReverseProxyFullName              bool
 | 
			
		||||
	EnableCaptcha                           bool
 | 
			
		||||
	RequireCaptchaForLogin                  bool
 | 
			
		||||
	RequireExternalRegistrationCaptcha      bool
 | 
			
		||||
	RequireExternalRegistrationPassword     bool
 | 
			
		||||
	CaptchaType                             string
 | 
			
		||||
@@ -130,6 +131,7 @@ func newService() {
 | 
			
		||||
	Service.EnableReverseProxyEmail = sec.Key("ENABLE_REVERSE_PROXY_EMAIL").MustBool()
 | 
			
		||||
	Service.EnableReverseProxyFullName = sec.Key("ENABLE_REVERSE_PROXY_FULL_NAME").MustBool()
 | 
			
		||||
	Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool(false)
 | 
			
		||||
	Service.RequireCaptchaForLogin = sec.Key("REQUIRE_CAPTCHA_FOR_LOGIN").MustBool(false)
 | 
			
		||||
	Service.RequireExternalRegistrationCaptcha = sec.Key("REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA").MustBool(Service.EnableCaptcha)
 | 
			
		||||
	Service.RequireExternalRegistrationPassword = sec.Key("REQUIRE_EXTERNAL_REGISTRATION_PASSWORD").MustBool()
 | 
			
		||||
	Service.CaptchaType = sec.Key("CAPTCHA_TYPE").MustString(ImageCaptcha)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user