barseghyanartur / django-fobi

Form generator/builder application for Django done right: customisable, modular, user- and developer- friendly.
https://pypi.python.org/pypi/django-fobi
484 stars 112 forks source link

Treat empty SITE_KEY as error #239

Closed minusf closed 4 years ago

minusf commented 4 years ago

Recently I had a configuration error where the SITE_KEY remained unset and the empty defaults made the widget render without the captcha and subsequently fail every submission. While the form showed a validation error, it's not user friendly, and it took days until someone reported it. Lack of logging made tracking down this issue needlessly long as well. When this widget is required, having an empty SITE_KEY and/or SITE_SECRET is simply an error and should be handled as such.

While here, simplify the widget and add the SITE_KEY as the hidden input field's value= instead of creating a free floating <script> tag with a single variable. Use a custom data- field to make selection easy. TBH I think for this widget both label (never shown) and name do not make sense: name should just be hard coded, as there will never be more than one captcha in one page and then we could simply rely on name (or id)...

Remove the empty defaults, they dont make sense. This diff is against 0.16.1

PS. submitFormButton.removeAttr('type'); generates console errors Uncaught Error: type property can't be changed and probably shouldnt be used.

barseghyanartur commented 4 years ago

@minusf:

Thanks for bringing this up. That submitFormButton.removeAttr('type') is probably caused by another browser API change. I'll take a look at it ASAP.

The rest looks OK. I'm merging it into v0.16.x (and then into master).

barseghyanartur commented 4 years ago

P. S. Release will follow shortly.

barseghyanartur commented 4 years ago

Released in 0.16.3.