Skip to content

Commit

Permalink
Update the package namespace for the captcha library
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Feb 12, 2024
1 parent 6ac3163 commit 4c91492
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/views/test_card_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion virtual_library_card/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"compressor",
"absoluteuri",
"virtuallibrarycard.apps.VirtuallibrarycardConfig",
"captcha",
"django_recaptcha",
]

# Log level is taken from the env
Expand Down
2 changes: 1 addition & 1 deletion virtual_library_card/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions virtuallibrarycard/forms/forms_library_card.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 4c91492

Please sign in to comment.