Skip to content
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

How to exclude Honeypot value on submitted email? #176

Closed
ryanlao opened this issue Nov 7, 2017 · 3 comments
Closed

How to exclude Honeypot value on submitted email? #176

ryanlao opened this issue Nov 7, 2017 · 3 comments

Comments

@ryanlao
Copy link

ryanlao commented Nov 7, 2017

Since the script takes all the key names from the form submitted and sends it thru email, it also takes the honeypot key name. How do you exclude this? Thanks.

@mckennapsean
Copy link
Collaborator

mckennapsean commented Nov 8, 2017

Easy peasy, you just need to add in some code to make sure that the special item named honeypot is not stored in the fields variable. I would suggest using a filter before the map. Would look something like:

// here is the start of the line to edit, note you are adding in a filter before the map
var fields = Object.keys(elements).filter(function(k) {
    
        // the filtering logic is simple, only keep fields that are not the honeypot
        return (elements[k].name !== 'honeypot');

    // leave the rest of the code alone
    }).map(function(k) {
        // altering the data here
    }).filter(function(item, pos, self) {
        // more filtering going on here
    });

We could add some up to date instructions in the readme, anyone feel free to PR.

@ryanlao
Copy link
Author

ryanlao commented Nov 10, 2017

Yes, it worked! Thanks @mckennapsean.

@mckennapsean
Copy link
Collaborator

this was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants