Skip to main content

Django Login Email

PyPI Documentation Status Downloads

Allow user to login and register with email address.

NOTICE: We are currently in the development stage. If you use this library, please upgrade to the latest version. Issues are welcome.

You can view the documentation here.

Install

pip install django-login-email

List of the urls for exmaple project:

  • /home for protected url.
  • /account/login for login.
  • /account/logout for logout.
  • /account/verify for email verify.

Feature

  • The developer could define their own User model.
  • Time-limited of login link.
  • limited of sending email. Using TimeLimt to set minutes.
  • The link could be used for Login once.
  • Register new user.
  • Support multiple user.
  • Ban the IP to send mail frequently without login.
  • Support django-templated-email
  • Support Django Anymail
  • Allow users to change their email address.
  • Enable 2FA.
  • More easier and customizable login link.

Usage

  • add django_login_email to your app settings.py.
INSTALLED_APP = [
    ...,
    'django_login_email',
    ...
]
  • Implement the LoginView, for example, like this:
from django.shortcuts import render
from django.urls import reverse

from django_login_email import email as e
from django_login_email import views as v

# Create your views here.

loginInfo, registerInfo = e.get_info_class("meterhub")


class LoginView(v.EmailLoginView):
  login_info_class = loginInfo
  register_info_class = registerInfo


class VerifyView(v.EmailVerifyView):
  def get_success_url(self):
    return reverse("home")


class LogoutView(v.EmailLogoutView):
  pass
  • set the view in your urls.py.
from django.contrib import admin
from django.urls import path
from <yourapp> import views as v
from django_login_email.views import HomeView

urlpatterns = [
    ...,
    path("account/login", v.LoginView.as_view(), name="login"),
    path("account/verify", v.VerifyView.as_view(), name="verify"),
    path("account/logout", v.LogoutView.as_view(), name="logout"),
    path("", HomeView.as_view(), name="home"),
]

That's all.

Debug the email with docker run -d --name mailhog -p 1025:1025 -p 8025:8025 mailhog/mailhog

Settings

  1. Config LoginView.tl to disable login attempts check.
  2. View settings/settings.py to config the email server account. As same as django official settings.
  3. Disable login check:
class YouLoginView(LoginView):
  def check_could_send(self, email) -> bool:
    # FOR DEBUG
    return True

Future

  • Academically prove the safety of this method.

Metadata

Release files for django-login-email 0.6.3

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-login-email 0.6.3
File Size Uploaded Provenance Actions
django_login_email-0.6.3.tar.gz 18.1 kB Without provenance Details for django_login_email-0.6.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-login-email 0.6.3
File Interpreter ABI Platform Actions
django_login_email-0.6.3-py3-none-any.whl Python 3 none any Details for django_login_email-0.6.3-py3-none-any.whl

Total release size: 45.3 kB

Release files / django_login_email-0.6.3.tar.gz

Download URL django_login_email-0.6.3.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
faafa40d1b2b18e6946111c2e3446b1ce8a9c1b182dd37556f45e350b33c9cc6
BLAKE2b-256 checksum
How to use checksums
31014fcfd0c34aa060cb749f3ce485f50661c53b2abb4fa8ca9a035b4dffe947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / django_login_email-0.6.3-py3-none-any.whl

Download URL django_login_email-0.6.3-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da61cc80754f4bf2063834010a5b65e03b2807938bff00aec56d3840d8dc55a4
BLAKE2b-256 checksum
How to use checksums
da28557d255040bd4fd21c90945de00156152e8ab9b939d9996f759ef1f94718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Security for django-login-email 0.6.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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