A Django application that provides a custom User model where the username is the email address.
Project description
Django Rapyd ModernAuth
A small Django pluggable app that provides a custom User model where the email address is the username. No username field, no extra settings, no migrations beyond the initial one.
Inspiration
Users today expect to use their email address as the username during authentication. This works well because:
- Users already know their email addresses by heart.
- Since email addresses are unique, users don't need to remember yet another item when either signing up or logging into web applications. IMHO this is a significant factor that plays a vital role in user adoption.
- This is a time tested model and many web applications today follow this.
However, Django's default approach for authentication requires a user provide both a username and an email address during sign up and then just use the username during login.
Requirements
- Python 3.10, 3.11, 3.12, or 3.13
- Django 4.2 LTS or Django 5.2 LTS
Installation
Important: swap in this user model before running
migratefor the first time. SwitchingAUTH_USER_MODELmid-project requires hand-written data migrations across every foreign key to the user model. See Django's docs on substituting a custom user model.
Install the package:
pip install django-rapyd-modernauth
Add modernauth to INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"modernauth",
]
Point Django at the custom user model in settings.py:
AUTH_USER_MODEL = "modernauth.User"
Create the database tables:
python manage.py migrate
Usage
The custom User model behaves like Django's default AbstractUser with one difference: email is the unique identifier and there is no username field. Use get_user_model() rather than importing the model directly so your code keeps working if AUTH_USER_MODEL is ever swapped again.
from django.contrib.auth import get_user_model
User = get_user_model()
User.objects.create_user(email="alice@example.com", password="…")
User.objects.create_superuser(email="root@example.com", password="…")
The admin's createsuperuser command will prompt for an email instead of a username:
python manage.py createsuperuser
Login forms, the admin, and authenticate() all use email as the credential.
Contributing
Pull requests are welcome — the project is intentionally small, so bug fixes, test improvements, and Django LTS support updates are the most likely to land. See CONTRIBUTING.md for the full development setup, test workflow, and release process.
For security vulnerabilities, see SECURITY.md for the private disclosure process. Do not file a public issue for security bugs.
License
Apache License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_rapyd_modernauth-0.0.7.tar.gz.
File metadata
- Download URL: django_rapyd_modernauth-0.0.7.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ba189f4ce2fe23bf1e13325de230d627313b9ad127445878043eabac7fabbf1
|
|
| MD5 |
1ce77123db29257dec22aa57174aaf5d
|
|
| BLAKE2b-256 |
14993b5686de89c810e374b5d17b8aa9cf141d7af0df30b330c3bd2117bec219
|
Provenance
The following attestation bundles were made for django_rapyd_modernauth-0.0.7.tar.gz:
Publisher:
publish.yml on karthicraghupathi/django_rapyd_modernauth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_rapyd_modernauth-0.0.7.tar.gz -
Subject digest:
0ba189f4ce2fe23bf1e13325de230d627313b9ad127445878043eabac7fabbf1 - Sigstore transparency entry: 1438132569
- Sigstore integration time:
-
Permalink:
karthicraghupathi/django_rapyd_modernauth@29938f429dbeb38d2394d277922079f6ef017d1f -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/karthicraghupathi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29938f429dbeb38d2394d277922079f6ef017d1f -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_rapyd_modernauth-0.0.7-py3-none-any.whl.
File metadata
- Download URL: django_rapyd_modernauth-0.0.7-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca3bd232eb53bb8c3d22a52b65f8860fe7ca1bbe7688eef6b077085942673bd7
|
|
| MD5 |
d0b4002d9e54fb473230b15de3e66e88
|
|
| BLAKE2b-256 |
6a71a5a004b191edca1d37fa0dee78fef0fa398d3599dbc3585151c8ef698969
|
Provenance
The following attestation bundles were made for django_rapyd_modernauth-0.0.7-py3-none-any.whl:
Publisher:
publish.yml on karthicraghupathi/django_rapyd_modernauth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_rapyd_modernauth-0.0.7-py3-none-any.whl -
Subject digest:
ca3bd232eb53bb8c3d22a52b65f8860fe7ca1bbe7688eef6b077085942673bd7 - Sigstore transparency entry: 1438132571
- Sigstore integration time:
-
Permalink:
karthicraghupathi/django_rapyd_modernauth@29938f429dbeb38d2394d277922079f6ef017d1f -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/karthicraghupathi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29938f429dbeb38d2394d277922079f6ef017d1f -
Trigger Event:
release
-
Statement type: