diff --git a/README.md b/README.md index b2f5798..eba530a 100644 --- a/README.md +++ b/README.md @@ -161,9 +161,9 @@ The site should be available in your browser for testing at `https://localhost:8 ## Other settings -The `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY` must be set if the `captcha` django plugin +The `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY` must be set if the `django_recaptcha` django plugin is installed via the `INSTALLED_APPS` setting. -If the `captcha` App is not in the `INSTALLED_APPS` setting, the signup flow will silently remove the need for +If the `django_recaptcha` App is not in the `INSTALLED_APPS` setting, the signup flow will silently remove the need for captcha to be present on that page. ### Environment Variables diff --git a/poetry.lock b/poetry.lock index 7c77601..482da9e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -512,13 +512,13 @@ files = [ [[package]] name = "django-recaptcha" -version = "3.0.0" +version = "4.0.0" description = "Django recaptcha form field/widget app." optional = false python-versions = "*" files = [ - {file = "django-recaptcha-3.0.0.tar.gz", hash = "sha256:253197051288923cae675d7eff91b619e3775311292a5dbaf27a8a55ffebc670"}, - {file = "django_recaptcha-3.0.0-py3-none-any.whl", hash = "sha256:1aed69fd6ac8fd9e99e52665392ae6748f8b6339ace656fad779fe0c6c915a52"}, + {file = "django-recaptcha-4.0.0.tar.gz", hash = "sha256:5316438f97700c431d65351470d1255047e3f2cd9af0f2f13592b637dad9213e"}, + {file = "django_recaptcha-4.0.0-py3-none-any.whl", hash = "sha256:0d912d5c7c009df4e47accd25029133d47a74342dbd2a8edc2877b6bffa971a3"}, ] [package.dependencies] @@ -1630,4 +1630,4 @@ test = ["websockets"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<4" -content-hash = "87bebebf655687bd1e1b916daa975c96a81ba5eed393cc752a3d5f042b05f469" +content-hash = "822de3c580cf4c69626a9817a5e5cefb4216d571bfccf5c6eec1b079c3862d2e" diff --git a/pyproject.toml b/pyproject.toml index c3f86dd..fb5a6c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ django-localflavor = "4.0" django-localflavor-us = "1.1" django-material = "1.12.0" django-materialize-css = "0.0.1" -django-recaptcha = "^3.0.0" +django-recaptcha = "^4.0.0" django-render-block = "0.9.2" django-storages = "^1.13.2" djangorestframework = "3.14.0" diff --git a/tests/views/test_card_views.py b/tests/views/test_card_views.py index 45ae0ee..80439fc 100644 --- a/tests/views/test_card_views.py +++ b/tests/views/test_card_views.py @@ -387,11 +387,11 @@ def test_card_request_email_no_duplicates(self): def test_card_request_no_captcha_installed(self): # Remove captcha from the installed apps installed_apps = [ac.name for ac in apps.get_app_configs()] - installed_apps.remove("captcha") + installed_apps.remove("django_recaptcha") apps.set_installed_apps(installed_apps) new_apps = [ac.name for ac in apps.get_app_configs()] - assert "captcha" not in new_apps + assert "django_recaptcha" not in new_apps self.test_card_request(with_captcha=False) apps.unset_installed_apps() diff --git a/virtual_library_card/settings/base.py b/virtual_library_card/settings/base.py index d1354eb..cc191ae 100644 --- a/virtual_library_card/settings/base.py +++ b/virtual_library_card/settings/base.py @@ -38,7 +38,7 @@ "compressor", "absoluteuri", "virtuallibrarycard.apps.VirtuallibrarycardConfig", - "captcha", + "django_recaptcha", ] # Log level is taken from the env diff --git a/virtual_library_card/settings/dev.py b/virtual_library_card/settings/dev.py index ba60f27..e437d1b 100644 --- a/virtual_library_card/settings/dev.py +++ b/virtual_library_card/settings/dev.py @@ -26,7 +26,7 @@ } # Testing ONLY -SILENCED_SYSTEM_CHECKS = ["captcha.recaptcha_test_key_error"] +SILENCED_SYSTEM_CHECKS = ["django_recaptcha.recaptcha_test_key_error"] ABSOLUTEURI_PROTOCOL = "http" DATE_INPUT_FORMATS = ["%m-%d-%Y"] diff --git a/virtuallibrarycard/forms/forms_library_card.py b/virtuallibrarycard/forms/forms_library_card.py index 1691a3a..b505d62 100644 --- a/virtuallibrarycard/forms/forms_library_card.py +++ b/virtuallibrarycard/forms/forms_library_card.py @@ -1,12 +1,12 @@ from datetime import datetime -from captcha.fields import ReCaptchaField from django import forms from django.apps import apps from django.contrib.auth.forms import UserCreationForm from django.core.exceptions import ValidationError from django.forms import ModelForm from django.utils.translation import gettext as _ +from django_recaptcha.fields import ReCaptchaField from virtual_library_card.logging import LoggingMixin from virtual_library_card.sender import Sender @@ -54,7 +54,7 @@ def __init__(self, *args, **kwargs): self.fields["first_name"].required = True # keep the captcha part dynamic, in case captcha is not supported - if apps.is_installed("captcha"): + if apps.is_installed("django_recaptcha"): self.fields["captcha"] = ReCaptchaField() user = kwargs["instance"]