django-login-email


Namedjango-login-email JSON
Version 0.4.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-04-06 04:50:15
maintainerNone
docs_urlNone
authorsvtter
requires_python<4.0,>=3.11
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Login Email

Allow user to login with only email.

## 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.
- [ ] Ban the IP to send mail frequently without login.
- [ ] Multiple user.
- [ ] 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_login_email import views as v
from django_login_email import email as e

# Create your views here.


class MyInfo(e.EmailLoginInfo):
    def set_variables(self):
        self.subject = "Login request from meterhub"
        self.welcome_text = "Welcome to meterhub! Please click the link below to login.<br>"
        self.from_email = "sandbox.smtp.mailtrap.io"


class LoginView(v.EmailLoginView):
    email_info_class = MyInfo


class VerifyView(v.EmailVerifyView):
    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.

## 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": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "svtter",
    "author_email": "svtter@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/bd/f3fae15a2247ac470d342c2162bd6729b0b1fb5e9bdbfbbe6e83c6a1b49f/django_login_email-0.4.1.tar.gz",
    "platform": null,
    "description": "# Django Login Email\n\nAllow user to login with only email.\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- [ ] Ban the IP to send mail frequently without login.\n- [ ] Multiple user.\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_login_email import views as v\nfrom django_login_email import email as e\n\n# Create your views here.\n\n\nclass MyInfo(e.EmailLoginInfo):\n    def set_variables(self):\n        self.subject = \"Login request from meterhub\"\n        self.welcome_text = \"Welcome to meterhub! Please click the link below to login.<br>\"\n        self.from_email = \"sandbox.smtp.mailtrap.io\"\n\n\nclass LoginView(v.EmailLoginView):\n    email_info_class = MyInfo\n\n\nclass VerifyView(v.EmailVerifyView):\n    pass\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\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\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.4.1",
    "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": "",
            "digests": {
                "blake2b_256": "ae82001b4ff943ef64d842e080bd952025e46bf73bd9e0e2e964f7916f9b24fc",
                "md5": "db48510d3262db33e1788d9457ed8e80",
                "sha256": "a1f9c634c46d497be1b0577004fb0990a480995c46fec6fa5f55f507803330b2"
            },
            "downloads": -1,
            "filename": "django_login_email-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db48510d3262db33e1788d9457ed8e80",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 14725,
            "upload_time": "2024-04-06T04:50:12",
            "upload_time_iso_8601": "2024-04-06T04:50:12.942600Z",
            "url": "https://files.pythonhosted.org/packages/ae/82/001b4ff943ef64d842e080bd952025e46bf73bd9e0e2e964f7916f9b24fc/django_login_email-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6bdf3fae15a2247ac470d342c2162bd6729b0b1fb5e9bdbfbbe6e83c6a1b49f",
                "md5": "1e8ba0a9733717a70fa60787fb6ab31f",
                "sha256": "3d21bc6f85bc582d344d7824a50c3cd6f069c7a163b69a5b1095fe9378cc2425"
            },
            "downloads": -1,
            "filename": "django_login_email-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1e8ba0a9733717a70fa60787fb6ab31f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 9167,
            "upload_time": "2024-04-06T04:50:15",
            "upload_time_iso_8601": "2024-04-06T04:50:15.348773Z",
            "url": "https://files.pythonhosted.org/packages/e6/bd/f3fae15a2247ac470d342c2162bd6729b0b1fb5e9bdbfbbe6e83c6a1b49f/django_login_email-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-06 04:50:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Svtter",
    "github_project": "django-login-email",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-login-email"
}
        
Elapsed time: 0.25363s