-
Notifications
You must be signed in to change notification settings - Fork 81
Add honeypot field validation to newsletter form #1072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,15 @@ const MzpNewsletter = { | |
const countrySelect = form.querySelector('select[name="country"]'); | ||
const lang = form.querySelector('#id_lang').value; | ||
const terms = form.querySelector('input[name="terms"]'); | ||
// Note: 'office_fax' is the honeypot field name used by Bedrock/Springfield | ||
// See: https://github.com/mozilla/bedrock/issues/16231 | ||
const honeypotField = form.querySelector('input[name="office_fax"]'); | ||
if (honeypotField && honeypotField.value.trim()) { | ||
MzpNewsletter.handleFormError( | ||
ERROR_LIST.NOT_FOUND | ||
); | ||
return false; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this may in some cases prevent submission, I think it could be worth not only mentioning this honeypot addition in the changelog; but even finding a good place in the component docs or example descriptions to note there's now this special cased |
||
|
||
// Really basic client side email validity check. | ||
if (!MzpNewsletter.checkEmailValidity(email)) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.