Add Cap Captcha support (#2511)
* Add Cap Captcha support - Add CaptchaCap type constant in types.go - Add Cap struct with InstanceURL, KeyID, and KeySecret fields - Add CapCaptcha method in provider.go to return Cap settings - Add default settings for Cap captcha in setting.go - Implement Cap captcha verification logic in middleware - Expose Cap captcha settings in site API This adds support for Cap captcha service as an alternative captcha option alongside existing reCAPTCHA, Turnstile and built-in captcha options. * update cap json tags
This commit is contained in:
@@ -38,6 +38,8 @@ type (
|
||||
TcCaptcha(ctx context.Context) *TcCaptcha
|
||||
// TurnstileCaptcha returns the Cloudflare Turnstile settings.
|
||||
TurnstileCaptcha(ctx context.Context) *Turnstile
|
||||
// CapCaptcha returns the Cap settings.
|
||||
CapCaptcha(ctx context.Context) *Cap
|
||||
// EmailActivationEnabled returns true if email activation is required.
|
||||
EmailActivationEnabled(ctx context.Context) bool
|
||||
// DefaultGroup returns the default group ID for new users.
|
||||
@@ -638,6 +640,14 @@ func (s *settingProvider) TurnstileCaptcha(ctx context.Context) *Turnstile {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *settingProvider) CapCaptcha(ctx context.Context) *Cap {
|
||||
return &Cap{
|
||||
InstanceURL: s.getString(ctx, "captcha_cap_instance_url", ""),
|
||||
KeyID: s.getString(ctx, "captcha_cap_key_id", ""),
|
||||
KeySecret: s.getString(ctx, "captcha_cap_key_secret", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *settingProvider) ReCaptcha(ctx context.Context) *ReCaptcha {
|
||||
return &ReCaptcha{
|
||||
Secret: s.getString(ctx, "captcha_ReCaptchaSecret", ""),
|
||||
|
||||
Reference in New Issue
Block a user