A django app for login with email.
Project description
Django Login Email
Allow user to login and register with email address.
Install
pip install django-login-email
List of the urls for exmaple project:
/homefor protected url./account/loginfor login./account/logoutfor logout./account/verifyfor email verify.
Feature
- The developer could define their own
Usermodel. - 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.
- Change email address.
- Ban the IP to send mail frequently without login.
- Enable 2FA.
- More easier and customizable login link.
Usage
- add
django_login_emailto your appsettings.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
Future
- Academically prove the safety of this method.
Related project
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
django_login_email-0.5.2.tar.gz
(16.0 kB
view details)
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_login_email-0.5.2.tar.gz.
File metadata
- Download URL: django_login_email-0.5.2.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1715cc52b23a62b15554cf198576b35270c95c0d064c9352bce3afd73a103e7a
|
|
| MD5 |
2af9c10e063b7868cb8bf5320798b631
|
|
| BLAKE2b-256 |
0114799b06acba4fed76209f6bd62093a4e9689932e0cd1c8605c821826d8441
|
File details
Details for the file django_login_email-0.5.2-py3-none-any.whl.
File metadata
- Download URL: django_login_email-0.5.2-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ef7c8265b15fb2f741c04a7767653b0c1ce835fe8214c06b5c9d677be8978d1
|
|
| MD5 |
ce09eaff2de6ac18d2193aaa29942cab
|
|
| BLAKE2b-256 |
dca13933f1e1701d358b53c8e3fe566ed04f57510c745050d35680e5c3040db9
|