rapid-data/captcha-bundle

提供对 Google ReCaptcha v2 和 hCaptcha 替代方案的抽象层。

1.1.2 2022-11-17 11:35 UTC

This package is auto-updated.

Last update: 2024-09-17 15:36:22 UTC


README

提供 Google ReCaptcha v2 或 hCaptcha 替代方案,用于表单。

配置

对于两个 Captcha 提供商,在相应账户中使用时,必须生成 SiteKeySecret。然后在 Bundle 配置中记录,在 contao/config.yml 文件中。

rapid_data_captcha:
    sitekey: '612b2149-xxxx-4ff0-xxxx-907ef3050b9b'
    secret: '0xxxxxxxxx5a21b154E2b274041ff5aC72aAda591D2'

提示:如果配置文件不存在,将自动尝试从 .env 文件中获取 CAPTCHA_SITEKEYCAPTCHA_SECRET

如果应使用 Google reCaptcha,则需要调整服务配置(默认为 hCaptcha)。

services:
    RapidData\CaptchaBundle\Service\CaptchaInterface:
        alias: 'RapidData\CaptchaBundle\Service\ReCaptchaService'
        public: true

如果应使用 Friendly Captcha,则需要调整服务配置(默认为 hCaptcha)。

services:
    RapidData\CaptchaBundle\Service\CaptchaInterface:
        alias: 'RapidData\CaptchaBundle\Service\FriendlyCaptchaService'
        public: true