erkenes / flow-honeypot-form-field
使用蜜罐字段进行垃圾邮件防护
该软件包的规范存储库似乎已消失,因此该软件包已被冻结。
1.0.0
2022-01-06 18:10 UTC
README
此软件包添加了一个HoneypotField元素,该元素可以在您的表单中使用。此元素被渲染为隐藏,不应由实际表单用户填写。
一个垃圾邮件检测完成器检查表单中是否包含此类蜜罐字段。如果这些字段中的任何一个被填写,则会引入额外的字段值,这些值可以在以下完成器中使用以处理垃圾邮件。
安装
composer require erkenes/flow-honeypot-form-field
使用
使用flow表单配置
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: 'Erk.Flow.HoneypotFormField:HoneypotField' identifier: 'full_name' finishers: spamDetection: identifier: 'Erk.Flow.HoneypotFormField:SpamDetectionFinisher'
完成器向表单状态添加以下新表单字段
字段名 | 值 |
---|---|
spamDetected | 当提交的表单被检测为垃圾邮件时,为布尔值true / false |
spamMarker | 如果检测到,包含[SPAM]。可以在电子邮件中使用 |
spamFilledOutHoneypotFields | 包含填写的蜜罐字段 |
与NeosCMS一起使用
如果您仅使用Flow-Framework而不使用NeosCMS,则此软件包是首选。如果您使用NeosCMS,请使用以下软件包: DL.HoneypotFormField。
此存储库是对上述软件包的修改,其中删除了所有NeosCMS功能。
标记发送的邮件为垃圾邮件
然后可以使用这些字段标记邮件为垃圾邮件
finishers: spamDetection: identifier: 'Erk.Flow.HoneypotFormField:SpamDetectionFinisher' email: identifier: 'Neos.Form:Email' options: templatePathAndFilename: 'resource://[...].html' subject: '{formState.formValues.spamMarker} {subject}' # The marker was added here recipientAddress: 'recipient@mail.com' senderAddress: 'noreply@example.com' senderName: 'Example' replyToAddress: '{email}' format: 'html'
设置
在检测到垃圾邮件时取消邮件发送
当将cancelSubsequentFinishersOnSpamDetection
设置设置为true
时,如果表单被检测为垃圾邮件,则不会执行后续完成器。
finishers: confirmationMessage: identifier: 'Neos.Form:Confirmation' options: message: > Form successfully sent spamDetection: identifier: 'Erk.Flow.HoneypotFormField:SpamDetectionFinisher' email: identifier: 'Neos.Form:Email' options: templatePathAndFilename: 'resource://[...].html' subject: '[ Contact ] {subject}' recipientAddress: 'recipient@mail.com' senderAddress: 'noreply@example.com' senderName: 'Example' replyToAddress: '{email}' format: 'html'
此处显示确认消息,但取消发送邮件。
在检测到垃圾邮件时记录表单内容
为了调试垃圾邮件检测并查看正在进入的垃圾邮件类型,您可以将设置logSpamFormData
设置为true以启用完整表单内容的记录。