coderedcms icon indicating copy to clipboard operation
coderedcms copied to clipboard

Simple captcha

Open pppls opened this issue 4 years ago • 2 comments

Thank you for contributing! Please follow the guidelines below to submit your pull request. Additional details are available in our Contributor Guide.

Description of change

I added a simple captcha, based on comments in issue #420. @vsalvino mentioned he found a good open-source captcha package to integrate (https://django-simple-captcha.readthedocs.io/en/latest/index.html) and I found wagtail variants in the form of https://github.com/acarasimon96/wagtail-django-simple-captcha and https://github.com/springload/wagtail-django-recaptcha The latter has implemented the bulk of the work, the former just makes it so that it works with simple-captcha rather than recaptcha. I saw no easy way to import those existing package to integrate with coderedcms and rather opted to utilize their code directly (in the case of the CodeRedFormBuilder we could subclass it from WagtailCaptchaFormBuilder but I'm not sure if this is as trivial for the code in the CoderedFormPage class in the page_models file due to the fact that process_form_submission has been redefined somewhere earlier and because it does not subclass AbstractForm).

I have clearly marked which functions I am talking about but I would like input on how you prefer to reference their source code.

The functionality looks as follows: image and can be toggled via the spam_protection checkbox under settings.

Documentation

I added a small part that says the captcha will be created when toggling the spam_protection checkbox.

Tests

Due to not importing the packages themselves directly, we would need to copy the tests as well, but the structure of their testapp looks a bit different from what is being done in CodeRedCMS so I'm not sure to what extent I should copy it.

pppls avatar Oct 02 '21 11:10 pppls

Thanks for doing this work. Since it's a bigger change it might take a while to be fully reviewed, but it's on our radar. Thanks!

vsalvino avatar Jun 03 '22 15:06 vsalvino