dl/honeypotformfield

Neos 表单构建器使用的蜜罐字段进行垃圾邮件防护

2.1.2 2022-04-27 07:04 UTC

This package is auto-updated.

Last update: 2024-08-31 08:59:28 UTC


README

Latest Stable Version Total Downloads License

此包添加了一个 HoneypotField 元素,可以在表单中使用。此元素以隐藏方式渲染,不应由实际表单用户填写。

垃圾邮件检测终结器会检查表单是否包含此类蜜罐字段。如果这些字段中的任何一个被填写,则会引入额外的字段值,这些值可以在后续终结器中用于处理垃圾邮件。

安装

composer require dl/honeypotformfield

使用

使用流程表单配置

type: 'Neos.Form:Form'
identifier: 'my-form'
renderables:
  items:
    type: 'Neos.Form:Page'
    identifier: 'my-page'
    renderables:
      name:
        type: 'Neos.Form:SingleLineText'
        identifier: 'name'
      honeyPot:
        type: 'DL.HoneypotFormField:HoneypotField'
        identifier: 'full_name'

finishers:
  spamDetection:
    identifier: 'DL.HoneypotFormField:SpamDetectionFinisher'

使用 Neos 表单构建器

需要建议的包 neos/form-builder。

  1. 添加蜜罐表单字段(至少一个,越多越好)
  2. 在应该使用垃圾邮件标记的终结器之前添加垃圾邮件检测终结器。

Usage of honeypot field and detection finisher

终结器向表单状态添加以下新的表单字段

将发送的邮件标记为垃圾邮件

然后可以使用这些字段,例如将邮件标记为垃圾邮件。

Use the spam marker in email header

设置

在检测到垃圾邮件时取消邮件发送

cancelSubsequentFinishersOnSpamDetection 设置为 true 时,如果检测到表单为垃圾邮件,则不会执行后续终结器。

Use the spam marker in email header

这里显示确认消息,但取消邮件发送。

配置

DL:
  HoneypotFormField:
    cancelSubsequentFinishersOnSpamDetection: true

在检测到垃圾邮件时记录表单内容

为了调试垃圾邮件检测并查看正在进入的垃圾邮件类型,您可以通过将设置 logSpamFormData 设置为 true 来启用记录完整表单内容的日志。

配置

DL:
  HoneypotFormField:
    logSpamFormData: true