django-login-email


Namedjango-login-email JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryA django app for login with email.
upload_time2025-02-19 07:06:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Login Email

[![PyPI](https://img.shields.io/pypi/v/django-login-email.svg)](https://pypi.python.org/pypi/django-login-email/)
[![Documentation Status](https://readthedocs.org/projects/django-login-email/badge/?version=latest)](https://django-login-email.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/django-login-email/week)](https://pepy.tech/project/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:

- `/home` for protected url.
- `/account/login` for login.
- `/account/logout` for logout.
- `/account/verify` for email verify.

## Feature

- [x] The developer could define their own `User` model.
- [x] Time-limited of login link.
- [x] limited of sending email. Using TimeLimt to set minutes.
- [x] The link could be used for Login once.
- [x] Register new user.
- [x] Support multiple user.
- [x] Ban the IP to send mail frequently without login.
- [ ] Change email address.
- [ ] Enable 2FA.
- [ ] More easier and customizable login link.

## Usage

- add `django_login_email` to your app `settings.py`.

```python
INSTALLED_APP = [
    ...,
    'django_login_email',
    ...
]
```

- Implement the LoginView, for example, like this:

```python
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`.

```python
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](./settings/settings.py) to config the email server account. As same as django official settings.
3. Disable login check:

```python
class YouLoginView(LoginView):
  def check_could_send(self, email) -> bool:
    # FOR DEBUG
    return True
```

## Future

- Academically prove the safety of this method.

## Related project

- [django-login-with-email](https://github.com/wsvincent/django-login-with-email)
- [django-unique-user-email](https://github.com/carltongibson/django-unique-user-email)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-login-email",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "svtter <svtter@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/fb/91/ce122215b622f557c805b301f3eaebffe4c5c11e1c1b87eaa0da87ed08b8/django_login_email-0.6.0.tar.gz",
    "platform": null,
    "description": "# Django Login Email\n\n[![PyPI](https://img.shields.io/pypi/v/django-login-email.svg)](https://pypi.python.org/pypi/django-login-email/)\n[![Documentation Status](https://readthedocs.org/projects/django-login-email/badge/?version=latest)](https://django-login-email.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/django-login-email/week)](https://pepy.tech/project/django-login-email)\n\nAllow user to login and register with email address.\n\n## Install\n\n`pip install django-login-email`\n\nList of the urls for exmaple project:\n\n- `/home` for protected url.\n- `/account/login` for login.\n- `/account/logout` for logout.\n- `/account/verify` for email verify.\n\n## Feature\n\n- [x] The developer could define their own `User` model.\n- [x] Time-limited of login link.\n- [x] limited of sending email. Using TimeLimt to set minutes.\n- [x] The link could be used for Login once.\n- [x] Register new user.\n- [x] Support multiple user.\n- [x] Ban the IP to send mail frequently without login.\n- [ ] Change email address.\n- [ ] Enable 2FA.\n- [ ] More easier and customizable login link.\n\n## Usage\n\n- add `django_login_email` to your app `settings.py`.\n\n```python\nINSTALLED_APP = [\n    ...,\n    'django_login_email',\n    ...\n]\n```\n\n- Implement the LoginView, for example, like this:\n\n```python\nfrom django.shortcuts import render\nfrom django.urls import reverse\n\nfrom django_login_email import email as e\nfrom django_login_email import views as v\n\n# Create your views here.\n\nloginInfo, registerInfo = e.get_info_class(\"meterhub\")\n\n\nclass LoginView(v.EmailLoginView):\n  login_info_class = loginInfo\n  register_info_class = registerInfo\n\n\nclass VerifyView(v.EmailVerifyView):\n  def get_success_url(self):\n    return reverse(\"home\")\n\n\nclass LogoutView(v.EmailLogoutView):\n  pass\n\n\n\n```\n\n- set the view in your `urls.py`.\n\n```python\nfrom django.contrib import admin\nfrom django.urls import path\nfrom <yourapp> import views as v\nfrom django_login_email.views import HomeView\n\nurlpatterns = [\n    ...,\n    path(\"account/login\", v.LoginView.as_view(), name=\"login\"),\n    path(\"account/verify\", v.VerifyView.as_view(), name=\"verify\"),\n    path(\"account/logout\", v.LogoutView.as_view(), name=\"logout\"),\n    path(\"\", HomeView.as_view(), name=\"home\"),\n]\n```\n\nThat's all.\n\nDebug the email with `docker run -d --name mailhog -p 1025:1025 -p 8025:8025 mailhog/mailhog`\n\n## Settings\n\n1. Config `LoginView.tl` to disable login attempts check.\n2. View [settings/settings.py](./settings/settings.py) to config the email server account. As same as django official settings.\n3. Disable login check:\n\n```python\nclass YouLoginView(LoginView):\n  def check_could_send(self, email) -> bool:\n    # FOR DEBUG\n    return True\n```\n\n## Future\n\n- Academically prove the safety of this method.\n\n## Related project\n\n- [django-login-with-email](https://github.com/wsvincent/django-login-with-email)\n- [django-unique-user-email](https://github.com/carltongibson/django-unique-user-email)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A django app for login with email.",
    "version": "0.6.0",
    "project_urls": {
        "bugs": "https://github.com/Svtter/django-login-email/issues",
        "changelog": "https://github.com/Svtter/django-login-email/blob/master/CHANGELOG.md",
        "homepage": "https://github.com/Svtter/django-login-email",
        "repository": "https://github.com/Svtter/django-login-email.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6021256d9aa15ee5d3aa912cc8dcde751c3019758ee030ef629a8ac8b13c1abf",
                "md5": "62ae0cb1b038d59dc3c3454dfddb8ef0",
                "sha256": "a4122f21a820fbf1bc00e5924778ec04c1d288ef6ca92716330a0bd4af40a288"
            },
            "downloads": -1,
            "filename": "django_login_email-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62ae0cb1b038d59dc3c3454dfddb8ef0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 27068,
            "upload_time": "2025-02-19T07:06:25",
            "upload_time_iso_8601": "2025-02-19T07:06:25.254121Z",
            "url": "https://files.pythonhosted.org/packages/60/21/256d9aa15ee5d3aa912cc8dcde751c3019758ee030ef629a8ac8b13c1abf/django_login_email-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fb91ce122215b622f557c805b301f3eaebffe4c5c11e1c1b87eaa0da87ed08b8",
                "md5": "54df34811c6ed299f5fcc11a3c26cf39",
                "sha256": "39ad7ce1a3b81636b5b620a3d081cbedfc4a6eac52533da9f669d7823388a777"
            },
            "downloads": -1,
            "filename": "django_login_email-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "54df34811c6ed299f5fcc11a3c26cf39",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 17722,
            "upload_time": "2025-02-19T07:06:26",
            "upload_time_iso_8601": "2025-02-19T07:06:26.597969Z",
            "url": "https://files.pythonhosted.org/packages/fb/91/ce122215b622f557c805b301f3eaebffe4c5c11e1c1b87eaa0da87ed08b8/django_login_email-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-19 07:06:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Svtter",
    "github_project": "django-login-email",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-login-email"
}
        
Elapsed time: 1.55510s