From a3c0487151d52843a33bd6b427611e53551f6700 Mon Sep 17 00:00:00 2001 From: Paul Schilling Date: Mon, 21 Oct 2024 16:49:03 +0200 Subject: [PATCH] [#2813] Refactor math captcha on contactform - replace dedicated MathCaptcha field with simple IntegerField and perform actual captcha logic in the form view (the field was not thread-safe, the values - question + answer - had to be stored in the session, so there is no reason to keep the field) --- .../components/Contact/ContactForm.html | 2 +- src/open_inwoner/openklant/forms.py | 20 ++++++- .../openklant/tests/test_cms_plugins.py | 2 +- .../openklant/tests/test_contactform.py | 55 +++++++++++++------ .../openklant/views/contactform.py | 12 ++++ src/open_inwoner/openklant/views/utils.py | 28 ++++++++++ src/open_inwoner/utils/forms.py | 54 ------------------ .../utils/tests/test_form_fields.py | 52 ------------------ 8 files changed, 97 insertions(+), 128 deletions(-) create mode 100644 src/open_inwoner/openklant/views/utils.py delete mode 100644 src/open_inwoner/utils/tests/test_form_fields.py diff --git a/src/open_inwoner/components/templates/components/Contact/ContactForm.html b/src/open_inwoner/components/templates/components/Contact/ContactForm.html index 63a6eec19e..55dfbccc61 100644 --- a/src/open_inwoner/components/templates/components/Contact/ContactForm.html +++ b/src/open_inwoner/components/templates/components/Contact/ContactForm.html @@ -31,7 +31,7 @@