springload / wagtail-django-recaptcha

A simple recaptcha field for Wagtail Form Pages
https://pypi.python.org/pypi/wagtail-django-recaptcha/
MIT License
56 stars 20 forks source link

How to conditionaly use the captcha? #13

Open loicteixeira opened 6 years ago

loicteixeira commented 6 years ago

Made With Wagtail uses wagtail-django-recaptcha but does not use WagtailCaptchaFormBuilder directly and rather defines it's own form builder which conditionally inherit from it or Wagtail base FormBuilder depending on whether recaptcha has been configured for the current environment (e.g. don't use the captcha on dev).

While I can understand the intend, I'm not too keen on that kind of things but maybe that's just me. I'd be curious to hear from others how you feel about it?

Should this package conditionally add the captcha field on the same conditions as the utility linked above or stay away from such consideration?

loicteixeira commented 6 years ago

Pinging @BertrandBordage since you seem to use the package.

BertrandBordage commented 6 years ago

Simply add a condition to this line: https://github.com/springload/wagtail-django-recaptcha/blob/a790bcade9bf5544f81c1b0dbfe45161e34571e5/wagtailcaptcha/forms.py#L17

loicteixeira commented 6 years ago

Thanks @BertrandBordage.

Indeed the fix is simple but I was mostly concerned whether this would be considered related to the user's application logic and by the fact it will silently not insert the field if the application has a misconfiguration.

I'll leave the issue open for a little bit before taking action in case anybody else wants to jump in.