aryehraber / statamic-captcha

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

Captcha still shows on forms not declared in `forms` config #34

Closed sjclark closed 2 years ago

sjclark commented 2 years ago

Spent a while trying to figure out how I was having bots slip through and auto-submit one of my forms, even though it had a Captcha on the page. Turns out that although the page had the header code, and the Captcha displayed visually (and interactively) it wasn't actually added to my Captcha Forms Config (captcha.php). Which is definitely a mistake on my part 😂 but it did get me thinking that it was unsual that everything displayed correctly even though I hadn't chosen that form to display the Captcha.

For many sites I use the same form template (and fields etc) for multiple different forms - so I can easily see how this slipped through on my part.

tldr; would it be possible to make it so captchas only display on forms that have actually been chosen in the config? It seems like the forms setting only dictates which forms require validation, rather than where it is displayed?

aryehraber commented 2 years ago

Hey @sjclark, thanks for opening up this issue, you bring up an interesting point!

While your idea definitely makes sense, and would improve the developer experience, it's one of those things that's easier said than done... Will give it some thought!

As an alternative, would a forms: 'all' config option help you? Where instead of defining each form in the config, you opt-in to having all forms being checked by Captcha? This doesn't exist atm, but should be easier to implement than the conditional rendering solution.

sjclark commented 2 years ago

@aryehraber no worries I suspected that might be the answer! A forms 'all' would definitely be handy for my purposes! 😄

aryehraber commented 2 years ago

@sjclark This is now available in latest version (v1.8.0), instructions added to end of "Installation" section of README. Let me know if you notice any issues.

We can leave this issue open for now as your initial idea is still valid!

sjclark commented 2 years ago

Champion! Will give it a spin tomorrow, was actually thinking I don't think I have a single site where I'd want it on some forms and not on others - so really the all sorts it for me 😂 so you could close if you wanted

aryehraber commented 2 years ago

Great, glad it could be solved with this all option 👍

Hmm yeah, since you're the first to ask (after years of maintaining this Addon) I think I will close for now... but perhaps re-open in the future if others want something similar.