diff --git a/README.rst b/README.rst
index eb68ed9..1953986 100644
--- a/README.rst
+++ b/README.rst
@@ -16,6 +16,7 @@ Django Mail Auth features:
- custom user model support
- drop in Django admin support
- drop in Django User replacement
+- drop in Wagtail login replacement
- extendable SMS support
This project was inspired by:
@@ -43,7 +44,7 @@ Run this command to install ``django-mail-auth``::
Setup
-----
-First add `mailauth` to you installed apps::
+First add ``mailauth`` to you installed apps::
INSTALLED_APPS = [
# Django's builtin apps…
@@ -51,14 +52,17 @@ First add `mailauth` to you installed apps::
'mailauth',
'mailauth.contrib.admin', # optional
'mailauth.contrib.user', # optional
+ # optional, must be included before "wagtail.admin"
+ 'mailauth.contrib.wagtail',
+
# other apps…
]
-`mailauth.contrib.admin` is optional and will replace the admin's login
+``mailauth.contrib.admin`` is optional and will replace the admin's login
with token based authentication too.
-`mailauth.contrib.user` is optional and provides a new Django User model.
+``mailauth.contrib.user`` is optional and provides a new Django User model.
The new User model needs to be enabled via the ``AUTH_USER_MODEL`` setting::
AUTH_USER_MODEL = 'mailauth_user.EmailUser'
@@ -75,16 +79,18 @@ Next you will need to add the new authentication backend::
'mailauth.backends.MailAuthBackend',
)
-Django's `ModelBackend` is only needed, if you still want to support
+Django's ``ModelBackend`` is only needed, if you still want to support
password based authentication. If you don't, simply remove it from the list.
-Last but not least, go to your URL root config `urls.py` and add the following::
+Last but not least, go to your URL root config ``urls.py`` and add the following::
from django.urls import path
urlpatterns = [
path('accounts/', include('mailauth.urls')),
+ # optional, must be before "wagtail.admin.urls"
+ path('', include('mailauth.contrib.wagtail.urls')),
]
That's it!
diff --git a/mailauth/contrib/wagtail/__init__.py b/mailauth/contrib/wagtail/__init__.py
new file mode 100644
index 0000000..9848c73
--- /dev/null
+++ b/mailauth/contrib/wagtail/__init__.py
@@ -0,0 +1 @@
+default_app_config = 'mailauth.contrib.wagtail.apps.MailAuthWagtail'
diff --git a/mailauth/contrib/wagtail/apps.py b/mailauth/contrib/wagtail/apps.py
new file mode 100644
index 0000000..909a03a
--- /dev/null
+++ b/mailauth/contrib/wagtail/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class MailAuthWagtail(AppConfig):
+ name = 'mailauth.contrib.wagtail'
+ label = 'mailauth_wagtail'
diff --git a/mailauth/contrib/wagtail/templates/wagtailadmin/login.html b/mailauth/contrib/wagtail/templates/wagtailadmin/login.html
new file mode 100644
index 0000000..f25ab0a
--- /dev/null
+++ b/mailauth/contrib/wagtail/templates/wagtailadmin/login.html
@@ -0,0 +1,90 @@
+{% extends "wagtailadmin/admin_base.html" %}
+{% load wagtailadmin_tags i18n %}
+{% block titletag %}{% trans "Sign in" %}{% endblock %}
+{% block bodyclass %}login{% endblock %}
+
+{% block extra_css %}
+ {{ block.super }}
+
+
+{% endblock %}
+
+{% block furniture %}
+
+ {% if messages or form.errors %}
+