Skip to main content

Django MailAuth: Secure login links; no passwords required!

Django Mail Auth

version Documentation Status coverage license

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
screenshot from a login form

This project was inspired by:

Sponsors

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mail-auth 3.7.1
File Size Uploaded Provenance Actions
django_mail_auth-3.7.1.tar.gz 18.0 kB With provenance Details for django_mail_auth-3.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-mail-auth 3.7.1
File Interpreter ABI Platform Actions
django_mail_auth-3.7.1-py3-none-any.whl Python 3 none any Details for django_mail_auth-3.7.1-py3-none-any.whl

Total release size: 45.0 kB

Release files / django_mail_auth-3.7.1.tar.gz

Download URL django_mail_auth-3.7.1.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a13e748ab3712016df9297014e886a93ea014530f41e373146acf867e58c0d3d
BLAKE2b-256 checksum
How to use checksums
d4b19c1f3b6646085913a01e0f45368db071fbfaa3870fdd893fff4993a102c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

Release files / django_mail_auth-3.7.1-py3-none-any.whl

Download URL django_mail_auth-3.7.1-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c6bcd63f26a62e6b5744363acca348975ce8b1a154a54515f0e507678496c62
BLAKE2b-256 checksum
How to use checksums
645ccf32c7036f53fa3cb61f75d07b9a1bf1a0bce2f8f710fe2dc93bc401a7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

Security for django-mail-auth 3.7.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_mail_auth-3.7.1.tar.gz

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 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.7.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page