diff --git a/bedrock/mozorg/forms.py b/bedrock/mozorg/forms.py
index ce8c0f63ff4..4ab4e19c862 100644
--- a/bedrock/mozorg/forms.py
+++ b/bedrock/mozorg/forms.py
@@ -45,11 +45,12 @@ def render(self, name, value, attrs=None, renderer=None):
# semi-randomized in case we have more than one per page.
# this is maybe/probably overthought
honeypot_id = "office-fax-" + str(randrange(1001)) + "-" + str(datetime.now().strftime("%Y%m%d%H%M%S%f"))
+ tabindex_attr = 'tabindex="-1"'
return mark_safe(
'
'
''
- ''
- "
" % (honeypot_id, honeypot_txt, honeypot_id)
+ ''
+ "" % (honeypot_id, honeypot_txt, honeypot_id, tabindex_attr)
)
diff --git a/bedrock/newsletter/forms.py b/bedrock/newsletter/forms.py
index 9c1d486d959..44c2903008a 100644
--- a/bedrock/newsletter/forms.py
+++ b/bedrock/newsletter/forms.py
@@ -10,7 +10,7 @@
from product_details import product_details
-from bedrock.mozorg.forms import EmailInput, PrivacyWidget, strip_parenthetical
+from bedrock.mozorg.forms import EmailInput, HoneyPotWidget, PrivacyWidget, strip_parenthetical
from bedrock.newsletter import utils
from lib.l10n_utils.fluent import ftl, ftl_lazy
@@ -186,6 +186,8 @@ class NewsletterFooterForm(forms.Form):
privacy = forms.BooleanField(widget=PrivacyWidget(attrs={"data-testid": "newsletter-privacy-checkbox"}))
source_url = forms.CharField(required=False)
newsletters = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple())
+ # office_fax is a honeypot field
+ office_fax = forms.CharField(widget=HoneyPotWidget(attrs={"tabindex": "-1"}), required=False, empty_value="")
# has to take a newsletters argument so it can figure
# out which languages to list in the form.
@@ -251,6 +253,11 @@ def clean_source_url(self):
return su
+ def clean_office_fax(self):
+ honeypot = self.cleaned_data.pop("office_fax", None)
+ if honeypot:
+ raise forms.ValidationError("Your submission could not be processed")
+
class EmailForm(forms.Form):
"""
diff --git a/bedrock/newsletter/templates/newsletter/includes/form.html b/bedrock/newsletter/templates/newsletter/includes/form.html
index 15dbbbb931f..9ca3a70452a 100644
--- a/bedrock/newsletter/templates/newsletter/includes/form.html
+++ b/bedrock/newsletter/templates/newsletter/includes/form.html
@@ -15,6 +15,9 @@
{% endif %}
+ {# Honeypot field #}
+ {{ form.office_fax|safe }}
+
{% if include_title and is_multi_newsletter_form %}