{% extends "freeform/_layouts/settings" %} {% import "_includes/forms" as forms %} {% set title = "Spam"|t("freeform") %} {% block content %}
{{ redirectInput('freeform/settings/spam') }} {{ csrfInput() }}

{{ "Spam Settings"|t('freeform') }}

{{ "Honeypot"|t('freeform') }}

{{ forms.lightswitchField({ label: "Freeform Honeypot"|t('freeform'), instructions: "Enable this to use Freeform's built in Honeypot spam protection."|t('freeform'), name: "settings[freeformHoneypot]", on: settings.freeformHoneypot, toggle: 'honeypot-enhancement', errors: settings.errors("freeformHoneypot"), }) }}
{{ forms.textField({ label: "Custom Honeypot Field Name"|t('freeform'), instructions: "If you wish to change the default name of the Freeform Honeypot field, specify a value here."|t('freeform'), placeholder: "freeform_form_handle", name: "settings[customHoneypotName]", value: settings.customHoneypotName, errors: settings.errors("customHoneypotName"), }) }} {{ forms.lightswitchField({ label: "Javascript Enhancement"|t('freeform'), instructions: "Enable this to use Freeform's built-in Javascript enhancement for the Honeypot feature. This will require users have JS enabled for their browser and help fight spambots more aggressively."|t('freeform'), warning: "If caching your forms, please be sure to manually refresh the Honeypot token generated by Freeform with this feature."|t('freeform'), name: "settings[freeformHoneypotEnhancement]", on: settings.freeformHoneypotEnhancement, errors: settings.errors("freeformHoneypotEnhancement"), }) }}
{{ forms.textField({ label: "Custom Honeypot Failed Error Message"|t('freeform'), instructions: "If the form fails upon submit due to Spam protection measures AND the Spam Protection Behavior setting is set to 'Display Errors', show this error message instead of the default."|t('freeform'), name: "settings[customErrorMessage]", rows: 5, value: settings.customErrorMessage, errors: settings.errors("customErrorMessage"), }) }}
{{ forms.selectField({ id: "spam-protection-behaviour", label: "Spam Protection Behavior"|t('freeform'), instructions: "Select the behavior you'd like Freeform to take when it detects a submission as being spam."|t('freeform'), name: "settings[spamProtectionBehaviour]", value: settings.spamProtectionBehaviour, options: { "simulate_success": "Simulate Success (recommended)"|t('freeform'), "display_errors": "Display Errors (for debugging)"|t('freeform'), } }) }} {{ forms.lightswitchField({ label: "Bypass All Spam Checks for Logged in Users"|t('freeform'), instructions: "When enabled, Freeform will not run any spam protection measures for logged in users."|t('freeform'), name: "settings[bypassSpamCheckOnLoggedInUsers]", on: settings.bypassSpamCheckOnLoggedInUsers, errors: settings.errors("bypassSpamCheckOnLoggedInUsers"), }) }}

{{ "Spam Folder"|t('freeform') }}

{{ forms.lightswitchField({ label: "Use Spam Folder"|t('freeform'), instructions: "When enabled, all submissions caught by the honeypot or blocked email addresses, keywords and IP addresses will be flagged as spam and stored in the database, but available to manage in a separate menu inside Freeform."|t('freeform'), name: "settings[spamFolderEnabled]", on: settings.spamFolderEnabled, toggle: "spam-features", errors: settings.errors("spamFolderEnabled"), }) }}
{{ forms.lightswitchField({ label: "Automatically Purge Spam Submissions"|t('freeform'), instructions: "If you wish to have Freeform automatically purge submissions flagged as spam after a specified number of days, enable this setting and specify the number of days after submission date it should purge spammy submissions."|t('freeform'), warning: "Enabling this and saving this settings page will result in the purging of submissions flagged as spam feature beginning, and cannot be undone (it may not happen immediately, and may take a couple hours before the next process runs)."|t('freeform'), name: "purge-toggle", on: settings.purgableSpamAgeInDays, toggle: "purge", errors: settings.errors("purgableSpamAgeInDays"), }) }}
{{ forms.selectField({ label: "Days After Submission Date to Purge"|t('freeform'), instructions: "Select the number of days after spammy submissions have been submitted for Freeform to begin automatically purging. This process will only run every hour, and only when Freeform is accessed on the front end in templates or in the control panel."|t('freeform'), name: "settings[purgableSpamAgeInDays]", value: settings.purgableSpamAgeInDays, errors: settings.errors("purgableSpamAgeInDays"), id: "purge-value", options: { 0: "Please select"|t("freeform"), 1: "1 day"|t("freeform"), 2: "2 days"|t("freeform"), 3: "3 days"|t("freeform"), 4: "4 days"|t("freeform"), 5: "5 days"|t("freeform"), 6: "6 days"|t("freeform"), 7: "7 days"|t("freeform"), 14: "14 days"|t("freeform"), 30: "30 days"|t("freeform"), 60: "60 days"|t("freeform"), } }) }}

{{ "Blocking"|t('freeform') }}

{{ forms.textareaField({ label: "Block Email addresses"|t('freeform'), instructions: "Enter email addresses you would like blocked from being used in Email fields. Use asterisks for wildcards (e.g. \*@hotmail.ru), and separate multiples on new lines."|t('freeform'), name: "settings[blockedEmails]", rows: 5, value: settings.blockedEmails, errors: settings.errors("blockedEmails"), }) }} {{ forms.lightswitchField({ label: "Display errors about blocked email(s) under each email field?"|t('freeform'), instructions: "Enable this if you'd like field-based errors to display under the email field(s) that the user has entered blocked emails for. Not recommended for regular use, but helpful if trying to troubleshoot submission issues."|t('freeform'), name: "settings[showErrorsForBlockedEmails]", on: settings.showErrorsForBlockedEmails, toggle: "blocked-emails-error", errors: settings.errors("showErrorsForBlockedEmails"), }) }}
{{ forms.textField({ label: "Blocked Emails Error Message"|t('freeform'), instructions: "The message shown to users when blocked emails are submitted. Can use the {email} variable."|t('freeform'), name: "settings[blockedEmailsError]", value: settings.blockedEmailsError, errors: settings.errors("blockedEmailsError"), }) }}
{{ forms.textareaField({ label: "Block Keywords"|t('freeform'), instructions: "Enter keywords you would like blocked from being used in all text and textarea fields. Use quotes for phrases (e.g. \"generate new leads\"), asterisks for wildcards (e.g. lead*), and separate multiples on new lines. When attempting to block individual characters (e.g. Russian letters) or partial words or strings, be sure to make good use of the wildcard character by placing one before and after."|t('freeform'), name: "settings[blockedKeywords]", rows: 5, value: settings.blockedKeywords, errors: settings.errors("blockedKeywords"), }) }} {{ forms.lightswitchField({ label: "Display errors about blocked keyword(s) under each text/textarea field?"|t('freeform'), instructions: "Enable this if you'd like field-based errors to display under the field(s) that the user has entered blocked keywords for. Not recommended for regular use, but helpful if trying to troubleshoot submission issues."|t('freeform'), name: "settings[showErrorsForBlockedKeywords]", on: settings.showErrorsForBlockedKeywords, toggle: "blocked-keywords-error", errors: settings.errors("showErrorsForBlockedKeywords"), }) }}
{{ forms.textField({ label: "Blocked Keywords Error Message"|t('freeform'), instructions: "The message shown to users when blocked keywords are submitted. Can use {value} and {keyword} variables."|t('freeform'), name: "settings[blockedKeywordsError]", value: settings.blockedKeywordsError, errors: settings.errors("blockedKeywordsError"), }) }}
{{ forms.textareaField({ label: "Block IP addresses"|t('freeform'), instructions: "Enter IP addresses you would like blocked. Separate multiples on new lines."|t('freeform'), name: "settings[blockedIpAddresses]", rows: 5, value: settings.blockedIpAddresses, errors: settings.errors("blockedIpAddresses"), }) }}

{{ "Throttling"|t('freeform') }}

{% set input %} {{ forms.text({ id: "throttling-count", name: "settings[submissionThrottlingCount]", value: settings.submissionThrottlingCount, placeholder: "unlimited"|t('freeform'), }) }} {{ forms.select({ id: "throttling-time-frame", name: "settings[submissionThrottlingTimeFrame]", value: settings.submissionThrottlingTimeFrame, options: { m: "per minute"|t("freeform"), s: "per second"|t("freeform"), } }) }} {% endset %} {{ forms.field({ label: "Form Submission Throttling"|t("freeform"), instructions: "Globally (affecting all users) prevent spam or attacks by limiting the number of times all forms can be submitted within a given timeframe."|t("freeform"), errors: settings.errors("submissionThrottlingCount"), warning: "This feature is intended for extreme conditions, such as preventing your site from going down if attacked by a spammer. It should NOT be used as a 'fine-tuning' spam measure, as it applies to ALL users. For example, if you set it to '1 per minute', once one user submits any form, any other user will not be able to submit a form within that timeframe. A more realistic value for smaller websites is something like 50 per minute. Use extreme caution for larger and more active sites."|t('freeform'), }, input) }} {{ forms.textField({ label: "Minimum Submit Time"|t('freeform'), instructions: "The minimum amount of time (in seconds) that has to go by since loading the form for the user to be able to submit the form successfully. Otherwise the submission will be flagged as spam and the Spam Protection Behavior setting will take effect."|t('freeform'), name: "settings[minimumSubmitTime]", value: settings.minimumSubmitTime, errors: settings.errors("minimumSubmitTime"), }) }} {{ forms.textField({ label: "Form Submit Expiration"|t('freeform'), instructions: "The maximum amount of time (in minutes) a user has to submit the form before the form expires and the Spam Protection Behavior setting will take effect. This still has to be less than the Craft CSRF token expiry and PHP Session limit set for your server."|t('freeform'), name: "settings[formSubmitExpiration]", value: settings.formSubmitExpiration, errors: settings.errors("formSubmitExpiration"), }) }}
{% endblock %}