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

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.6.0
File Size Uploaded
django_mail_auth-3.6.0.tar.gz 17.8 kB Details

Built distribution (wheel)

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

Total release size: 44.8 kB

Release files / django_mail_auth-3.6.0.tar.gz

Download URL django_mail_auth-3.6.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a444b4a776d5cc289fc6e4a41772185761451c819e3e39134a5e6bcb2a9e8b61
BLAKE2b-256 checksum
How to use checksums
c776b854ef646ff10535272d8c36546ea84335d4efef47647b5cfc8c0c7da920
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

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

Download URL django_mail_auth-3.6.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffbca8b632eef9db0e55ae9f306931f62b947ec26fa74028bbbdfb6445985ece
BLAKE2b-256 checksum
How to use checksums
e1a018c2c4685f1b0a1e969ddb58314265920374a4616fd4620789cc1336b9e8
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

Release history Release notifications | RSS feed

3.7.0

2 release files

This release

3.6.0 This release

2 release files

3.5.5

2 release files

3.5.4

2 release files

3.5.3

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.4

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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