Django Mail Auth
Django Mail Auth is a lightweight authentication backend for Django, that does not require users to remember passwords.
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:
- Is it time for password-less login? by Ben Brown
- LOGIN WITHOUT PASSWORD MOST SECURE | WAIT.. WHAT? by Joris Snoek
- django-nopassword by Rolf Erik Lekang
Sponsors
Installation
Run this command to install django-mail-auth:
python3 -m pip install django-mail-auth[postgres,wagtail]
Use the [wagtail] extra to make sure you get a supported version of wagtail, if you use that.
If you want to use the PostgreSQL CIText extension for optimized case-insensitive search, use the [postgres] extra to install the necessary django-citext. You also need to make sure postgresql itself supports the CIText extension, for instance by installing a package like postgresql-contrib or compiling it with the extension included.
Setup
First add mailauth to you installed apps:
INSTALLED_APPS = [
# Django's builtin 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
with token based authentication too.
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:
# This setting should be either "EmailUser" or
# any custom subclass of "AbstractEmailUser"
AUTH_USER_MODEL = "mailauth_user.EmailUser"
# optional, Wagtail only
WAGTAILUSERS_PASSWORD_ENABLED = False
Next you will need to add the new authentication backend:
AUTHENTICATION_BACKENDS = (
# default, but now optional
# This should be removed if you use mailauth.contrib.user or any other
# custom user model that does not have a username/password
"django.contrib.auth.backends.ModelBackend",
# The new access token based authentication backend
"mailauth.backends.MailAuthBackend",
)
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 configuration 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!
Metadata
Release files for django-mail-auth 3.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_mail_auth-3.7.0.tar.gz | 17.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_mail_auth-3.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / django_mail_auth-3.7.0.tar.gz
| Download URL | django_mail_auth-3.7.0.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58781e22106b5783073113049f34384c0244fada24fc357d6dcbd47bdfa8ca21
|
|
BLAKE2b-256 checksum How to use checksums |
812fecf06b4be2da4fff769898167c421ddea71101d86d0321241d97f87ed2ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_mail_auth-3.7.0-py3-none-any.whl
| Download URL | django_mail_auth-3.7.0-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25fd79d50616833c97dde052ad237c1cbb607b10e64cf01d2a30e64f3ee8a0e4
|
|
BLAKE2b-256 checksum How to use checksums |
a330b366d0758d0ca956e119195290e8ed407aa21c38491a5d905118edaff70e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log