aryehraber / statamic-captcha

Statamic Addon that protects your Statamic forms using a Captcha service.
MIT License
11 stars 8 forks source link

Allow skipping verification for Collections #11

Closed aryehraber closed 3 years ago

aryehraber commented 3 years ago

This PR is an alternate approach to https://github.com/aryehraber/statamic-captcha/pull/10, allowing skipping Captcha verification for certain fields using an additional config option. Eg:

return [
    // ...
    'collections' => [
        'pages' => [
            'skip_fields' => ['foo', 'bar'],
        ],
        'blog',
        'other',
    ],
    // ...
];

@edalzell It would be great if you could review this and see if this works for your use case

edalzell commented 3 years ago

I will give it a try @aryehraber, but what about the _token field (CSRF)?

aryehraber commented 3 years ago

Good catch, my tests didn't go through a "real" form so I didn't need one. Will need to filter that out before the comparison 👍

aryehraber commented 3 years ago

@edalzell Ok just pushed an update! I ended up building a quick Workshop-like endpoint to edit CP content from the front-end for testing, so I'm fairly confident this works as expected now, but still curious to hear your take on it!

edalzell commented 3 years ago

@aryehraber looks good but I don't use recaptcha on this page so we'll have to see a good way to configure that perhaps.

I'll take a look at this this week. Thanks!

aryehraber commented 3 years ago

Hmm yeah, I guess it won't be there if it's on a form not using Captcha (which this PR is trying to solve), so will remove it again for the time-being until some issues regarding this are reported.

edalzell commented 3 years ago

Looks awesome, thanks! Merge away!