共生库/silverstripe-spamprotection-honeypot

为 SilverStripe CMS 提供蜜罐垃圾邮件防护。

2.0.1 2018-06-12 05:57 UTC

This package is auto-updated.

Last update: 2024-08-29 03:26:19 UTC


README

Latest Version on Packagist Software License Total Downloads

概述

为 SilverStripe CMS 提供蜜罐垃圾邮件防护。创建一个用户不可见的表单字段,如果该字段包含任何数据则无效化提交。同时,也会无效化响应过快的提交。

需求

  • SilverStripe 3.1.0 及以上版本或 3.2 及以上版本。
  • SilverStripe 垃圾邮件防护 1.2 及以上版本。

安装

通过 Composer

运行以下命令将此模块作为依赖项添加并使用 composer 进行安装。

$ composer require symbiote-library/silverstripe-spamprotection-honeypot

手动

将 'silverstripe-spamprotection-honeypot' 文件夹复制到您的 SilverStripe 安装根目录。

使用方法

mysite/_config 中创建一个名为 spamprotection.yml 的配置文件,配置如下。

---
name: spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: '\Symbiote\SilverStripe\SpamProtection\Honeypot\SpamProtector\HoneypotSpamProtector'

然后通过调用 Form::enableSpamProtection() 在您的表单上启用垃圾邮件防护。

public function ExampleForm()
{
    $form = new ExampleForm($this, 'Example');

    $form->enableSpamProtection();

    return $form;
}

您可以使用以下配置更改检查响应是否过快的时间量。

Symbiote\SilverStripe\SpamProtection\Honeypot\FormField\HoneypotField:
  time_limit: 1

此示例将时间更改为 1 秒。默认设置为 5 秒。

测试

$ phpunit

贡献

请参阅 CONTRIBUTING 了解详情。

安全

如果您发现任何与安全相关的问题,请通过电子邮件发送到 maintainers+library@symbiote.com.au,而不是使用问题跟踪器。

鸣谢

许可

BSD-2-Clause 许可证。请参阅 许可证文件 获取更多信息。