Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ updates:
ignore:
- dependency-name: flake8
versions:
- 3.8.4
- 3.9.0
- 7.3.0
- dependency-name: coverage
versions:
- "5.4"
- "7.13.4"
- dependency-name: pytest
versions:
- 6.2.2
- 9.0.2
- dependency-name: isort
versions:
- 5.7.0
- 8.0.1
- dependency-name: django-debug-toolbar
versions:
- "3.2"
- "6.2.0"
- dependency-name: pytest-django
versions:
- 4.1.0
- 4.12.0
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Unreleased
==================
- Add testing for Python 3.14, Wagtail 7.2, and Wagtail 7.3
- Update dependencies to latest versions


1.8.0 (2026-02-05)
==================
- bump required version of django-otp and update middleware
Expand Down
6 changes: 3 additions & 3 deletions sandbox/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=3.2
wagtail>=4.1
django-debug-toolbar==3.2.2
Django>=5.2
Wagtail>=7.0
django-debug-toolbar==6.2.0
-e .[docs,test]
1 change: 0 additions & 1 deletion sandbox/sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

Expand Down
9 changes: 5 additions & 4 deletions sandbox/sandbox/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debug_toolbar
from django.conf import settings
from django.contrib import admin
from django.urls import path
from django.urls import include, re_path

from wagtail import urls as wagtail_urls
Expand All @@ -9,9 +10,9 @@

urlpatterns = [
re_path(r'^admin/', admin.site.urls),
re_path(r'^cms/', include(wagtailadmin_urls)),
re_path(r'^documents/', include(wagtaildocs_urls)),
re_path(r'', include(wagtail_urls)),
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('', include(wagtail_urls)),
]


Expand All @@ -24,5 +25,5 @@
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns = [
re_path(r'^__debug__/', include(debug_toolbar.urls)),
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"Framework :: Wagtail :: 3",
"Framework :: Wagtail :: 4",
"Framework :: Wagtail :: 7",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
zip_safe=False,
)
6 changes: 5 additions & 1 deletion src/wagtail_2fa/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class VerifyUserMiddleware(_OTPMiddleware):
"wagtailadmin_sprite",
]

def get_allowed_url_names(self):
extra = getattr(settings, "WAGTAIL_2FA_ALLOWED_URL_NAMES", [])
return self._allowed_url_names + list(extra)

# These URLs do not require verification if the user has no devices
_allowed_url_names_no_device = [
"wagtail_2fa_device_list",
Expand Down Expand Up @@ -75,7 +79,7 @@ def _require_verified_user(self, request):

# Don't require verification for specified URL names
request_url_name = resolve(request.path_info).url_name
if request_url_name in self._allowed_url_names:
if request_url_name in self.get_allowed_url_names():
return False

# If the user does not have a device, don't require verification
Expand Down
5 changes: 4 additions & 1 deletion src/wagtail_2fa/templates/wagtail_2fa/device_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ <h2>

{# Users can only add devices to their own account #}
{% if user_id == request.user.id %}
<a href="{% url 'wagtail_2fa_device_new' %}" class="button bicolor icon icon-plus">{% trans 'New device' %}</a>
<a href="{% url 'wagtail_2fa_device_new' %}" class="button bicolor button--icon">
<span class="icon-wrapper"><svg class="icon icon-plus icon" aria-hidden="true"><use href="#icon-plus"></use></svg></span>
{% trans 'New device' %}
</a>
{% endif %}
</div>
{% endblock %}
62 changes: 0 additions & 62 deletions src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html

This file was deleted.

10 changes: 6 additions & 4 deletions src/wagtail_2fa/templates/wagtail_2fa/otp_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "wagtailadmin/admin_base.html" %}
{% extends "wagtailadmin/base.html" %}
{% load i18n wagtailadmin_tags %}
{% block titletag %}{% trans "Sign in" %}{% endblock %}
{% block bodyclass %}login{% endblock %}
Expand Down Expand Up @@ -31,11 +31,11 @@ <h1>{% block branding_login %}{% trans "Enter your two-factor authentication cod
<input type="hidden" name="next" value="{{ next|default:home_url }}" />

{% block fields %}
{% field field=form.otp_token %}{% endfield %}
{% formattedfield form.otp_token %}

{% block extra_fields %}
{% for field_name, field in form.extra_fields %}
{% field field=field %}{% endfield %}
{% formattedfield field %}
{% endfor %}
{% endblock extra_fields %}

Expand All @@ -45,7 +45,9 @@ <h1>{% block branding_login %}{% trans "Enter your two-factor authentication cod
{% block submit_buttons %}
<button type="submit" class="button button-longrunning" tabindex="3" data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value="{% trans 'Signing in…' %}">{% icon name="spinner" %}<em>{% trans 'Sign in' %}</em></button>
<span style="margin-top:1rem;display:block;">
<a href="{% url 'wagtailadmin_logout' %}" class="button button-secondary" tabindex="4">{% trans 'Sign out' %}</a>
<button type="submit" class="button button-secondary" formaction="{% url 'wagtailadmin_logout' %}?next={% url 'wagtailadmin_login' %}" formmethod="post" tabindex="4">
{% trans "Sign out" %}
</button>
</span>
{% endblock %}
</footer>
Expand Down
66 changes: 0 additions & 66 deletions src/wagtail_2fa/templates/wagtail_2fa/otp_form_v6.html

This file was deleted.

9 changes: 1 addition & 8 deletions src/wagtail_2fa/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@


class LoginView(RedirectURLMixin, FormView):

if WAGTAIL_VERSION >= (6, 0):
template_name = "wagtail_2fa/otp_form_v6.html"
elif WAGTAIL_VERSION < (6, 0) and WAGTAIL_VERSION >= (5, 0):
template_name = "wagtail_2fa/otp_form.html"
else:
template_name = "wagtail_2fa/legacy/otp_form.html"

template_name = "wagtail_2fa/otp_form.html"
form_class = forms.TokenForm
redirect_field_name = REDIRECT_FIELD_NAME

Expand Down
Loading