Easy email or SMS based login for Django
Project description
django-stagedoor
Easy email or SMS based login for Django
Installation
-
Add
stagedoortoINSTALLED_APPSINSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.sites", "stagedoor", ... ]
-
Add the authentication backends. Make sure to keep
ModelBackendfor the admin loginAUTHENTICATION_BACKENDS = ( "stagedoor.backends.EmailTokenBackend", "stagedoor.backends.SMSTokenBackend", "django.contrib.auth.backends.ModelBackend", )
-
Add urls
urlpatterns = [ path("admin/", admin.site.urls), path("auth/", include("stagedoor.urls", namespace="stagedoor")), ... ]
Features
- Email-based login with token links
- SMS-based login with one-time codes (via Twilio)
- Admin approval workflow (optional)
- Single-use token support
- Customizable templates and styling
- Support for Django 5.2+
- Management command to clean up stale tokens (
python manage.py cleanup_stale_tokens)
Configuration
See stagedoor/settings.py for available configuration options.
Security Considerations
- Tokens expire after a configurable duration (default: 30 minutes)
- Rate limiting available (via optional django-ratelimit)
- Tokens are generated using cryptographically secure randomness
- Email and SMS delivery should be verified for security
Usage Examples
Cleanup stale tokens
python manage.py cleanup_stale_tokens
Basic usage
In your views:
from stagedoor.services import create_login_token
def login_view(request):
# Create a token for user
token = create_login_token(request, email="user@example.com")
# Send the token via email
# ... email sending logic here
return redirect("token_post_page")
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_stagedoor-0.2.0.tar.gz.
File metadata
- Download URL: django_stagedoor-0.2.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff31185c01da6fa712f723b12ab5b005ff973cf4467e693d1368fc36a33e10bf
|
|
| MD5 |
a96a031b8a49a020b89a9c96a25aa3bc
|
|
| BLAKE2b-256 |
14cb95aedf877fc72b9c6b84ff37187cc0235c187b993f3244cbd5b7d175c849
|
Provenance
The following attestation bundles were made for django_stagedoor-0.2.0.tar.gz:
Publisher:
release.yml on galaxybrainco/django-stagedoor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_stagedoor-0.2.0.tar.gz -
Subject digest:
ff31185c01da6fa712f723b12ab5b005ff973cf4467e693d1368fc36a33e10bf - Sigstore transparency entry: 1429550811
- Sigstore integration time:
-
Permalink:
galaxybrainco/django-stagedoor@2b052cb306d6473ea64c1ed1bec04fef6efdbf10 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/galaxybrainco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b052cb306d6473ea64c1ed1bec04fef6efdbf10 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file django_stagedoor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_stagedoor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.9 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 |
37edaebf353b74ff9a9dfeea082cf96d3b0d57a0452a70bbb064bb0499d98205
|
|
| MD5 |
4298edb0f03434ad9d5ae8deeab3af4d
|
|
| BLAKE2b-256 |
2b8dc4574c6100e20ac09135fcda1f95428e9638b049b49b2b6c87fab8e37135
|
Provenance
The following attestation bundles were made for django_stagedoor-0.2.0-py3-none-any.whl:
Publisher:
release.yml on galaxybrainco/django-stagedoor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_stagedoor-0.2.0-py3-none-any.whl -
Subject digest:
37edaebf353b74ff9a9dfeea082cf96d3b0d57a0452a70bbb064bb0499d98205 - Sigstore transparency entry: 1429550812
- Sigstore integration time:
-
Permalink:
galaxybrainco/django-stagedoor@2b052cb306d6473ea64c1ed1bec04fef6efdbf10 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/galaxybrainco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b052cb306d6473ea64c1ed1bec04fef6efdbf10 -
Trigger Event:
workflow_dispatch
-
Statement type: