定制 oposs/silverstripe-hcaptcha 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oposs/silverstripe-hcaptcha

最新稳定版本:0.2.0

Composer 安装命令:

composer require oposs/silverstripe-hcaptcha

包简介

Protect your forms with hCaptcha

README 文档

README

Protect your forms with hCaptcha, a GDPR, CCPA, LGPD, PIPL and more compliant spam prodection (according their website)

Installation

Note: This version of the module is compatible with Silverstripe CMS 5.x. For Silverstripe 4.x compatibility, please use an earlier version/tag.

Make sure you met the following requirements beforehand:

  • SilverStripe 5.x
  • SilverStripe Spam Protection 4.x
  • PHP 8.1+
  • PHP CURL and JSON extensions
composer require oposs/silverstripe-hcaptcha

And set hCaptcha as your default spamprotector:

# app/_config/spamprotection.yml
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: Oposs\hCaptcha\hCaptchaProtector

Configuration

In your app/_config/hcaptcha.yml

Oposs\hCaptcha\Forms\hCaptchaField:
  site_key: 'your_site_key'
  # Make sure to set the key starting with 0x.. in quotes
  secret_key: 'your_secret_key'
  # To configure options listed here https://docs.hcaptcha.com/configuration
  api_configuration:
    recaptchacompat: 'off'

For more configuration options check comments in hCaptchaField.php

Usage

In php:

use Oposs\hCaptcha\hCaptchaProtector\Forms

new hCaptchaField('SpamProtection', 'SpamProtection', null);

Or if you use Userforms:

img.png

Troubleshooting

Q: Users are redirected to the main page when the captcha is incorrect or not solved

A: This is most likely a redirecting problem, if your site is running behind a proxy have a look at the Director's alternate_base_url property (albeit heavily used, not document yet...)

Contributions are welcome :)

统计信息

  • 总下载量: 1.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-25