定制 innoweb/silverstripe-spamprotection-honeypot 二次开发

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

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

innoweb/silverstripe-spamprotection-honeypot

最新稳定版本:3.0.0

Composer 安装命令:

composer require innoweb/silverstripe-spamprotection-honeypot

包简介

Provides invisible honeypot spam protection for Silverstripe CMS.

README 文档

README

Version Silverstripe Downloads Issues License

Overview

Provides invisible honeypot spam protection for Silverstripe CMS.

Creates form fields hidden from users that invalidate submission if the contained data has been tampered with. Also invalidates submissions that respond too quickly.

Requirements

Installation

Run the following to add this module as a requirement and install it via composer.

$ composer require innoweb/silverstripe-spamprotection-honeypot

Then run dev/build.

Usage

Create a configuration file spamprotection.yml in app/_config with the following configuration:

---
Name: app-spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: Innoweb\SpamProtectionHoneypot\SpamProtector\HoneypotSpamProtector

We also recommend changing the default field name from Captcha to something less obvious:

SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  field_name: 'AdditionalInformation'

Then enable spam protection on your form by calling Form::enableSpamProtection().

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

    $form->enableSpamProtection();

    return $form;
}

You can change the amount time that is checked to see if the response is made too quickly with the following configuration.

Innoweb\SpamProtectionHoneypot\FormField\HoneypotField:
  time_limit: 12

This example changes the time to 12 seconds. The default is set to 8 seconds.

You can also change the default text used in the value field, overriding the translation using your lang file (e.g. app/lang/en.yml):

en:
  Innoweb\SpamProtectionHoneypot\FormField\HoneypotField:
    DefaultValue: 'Some text that should not be touched.'

This defaults to 'Please leave this as is.'.

Contributing

Please see contributing for details.

Credits

Thanks to studiobonito/silverstripe-spamprotection-honeypot and symbiote-library/silverstripe-spamprotection-honeypot for the inspirations.

License

BSD 3-Clause License, see License

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-02-03