django-plaintext-password


Namedjango-plaintext-password JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/RealOrangeOne/django-plaintext-password
Summaryhttps://github.com/RealOrangeOne/django-plaintext-password
upload_time2023-05-12 15:31:50
maintainer
docs_urlNone
authorJake Howard
requires_python>=3.8
licenseBSD
keywords django password plaintext
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-plaintext-password

![CI](https://github.com/RealOrangeOne/django-plaintext-password/workflows/CI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/django-plaintext-password.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plaintext-password.svg)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-plaintext-password.svg)
![PyPI - Status](https://img.shields.io/pypi/status/django-plaintext-password.svg)
![PyPI - License](https://img.shields.io/pypi/l/django-plaintext-password.svg)


A Django password hasher to store passwords in plaintext.

## _"Should I use this in production?"_

Oh definitely not. Storing passwords in plaintext is a very *very* bad thing. Django's defaults are incredibly secure and should be used unless you have a good reason not to.

For more on why using this in production is a terrible idea, check out [How to store passwords](https://theorangeone.net/posts/how-to-store-passwords/).

When running deployment checks, this will throw a "CRITICAL" error if in use.

## Installation and usage

```
pip install django-plaintext-password
```

Then add `plaintext_password.PlaintextPasswordHasher` to [`PASSWORD_HASHERS`](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-PASSWORD_HASHERS) in `settings.py`. To ensure it's used by default, make it the first or only item.

## How does it work?

By default, Django will store the password `password123` in a format similar to:

```
pbkdf2_sha256$216000$gd57n4OWJrXh$Xs/TqhwJICOxsLONGlKXorjuWccooiuJmJOUaxbwcOQ=
```

This is good for security as the password has been both salted and hashed before being saved into the database, making it almost impossible to retrieve the original password. This library however, stores the password as-is:

```
plaintext$$password123
```

This makes searching by password possible, as well as comparing users passwords and allowing you to email users their passwords if they forget them - neat!

In addition to storing the values directly in the database for easy retrieval, the comparison is done simply with `==`, rather than using [`secrets.compare_digest`](https://docs.python.org/3/library/secrets.html#secrets.compare_digest).

## Why?

Well, why not?

Although in all seriousness, If as part of your tests you're creating a large number of users, or just a couple users but you've got a lot of tests, you can get quite a performance improvement by simplifying the password hasher.

Unfortunately due to a limitation (and feature) with Django, it's not possible to store just the value directly, it must be prefixed with the algorithm.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RealOrangeOne/django-plaintext-password",
    "name": "django-plaintext-password",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "django password plaintext",
    "author": "Jake Howard",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4e/c1/d17ff5bf814b274e1b3f4a230a2ee09d7d40e45c2ac5c032e9ecaa9a82dc/django-plaintext-password-0.2.0.tar.gz",
    "platform": null,
    "description": "# django-plaintext-password\n\n![CI](https://github.com/RealOrangeOne/django-plaintext-password/workflows/CI/badge.svg)\n![PyPI](https://img.shields.io/pypi/v/django-plaintext-password.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plaintext-password.svg)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-plaintext-password.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/django-plaintext-password.svg)\n![PyPI - License](https://img.shields.io/pypi/l/django-plaintext-password.svg)\n\n\nA Django password hasher to store passwords in plaintext.\n\n## _\"Should I use this in production?\"_\n\nOh definitely not. Storing passwords in plaintext is a very *very* bad thing. Django's defaults are incredibly secure and should be used unless you have a good reason not to.\n\nFor more on why using this in production is a terrible idea, check out [How to store passwords](https://theorangeone.net/posts/how-to-store-passwords/).\n\nWhen running deployment checks, this will throw a \"CRITICAL\" error if in use.\n\n## Installation and usage\n\n```\npip install django-plaintext-password\n```\n\nThen add `plaintext_password.PlaintextPasswordHasher` to [`PASSWORD_HASHERS`](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-PASSWORD_HASHERS) in `settings.py`. To ensure it's used by default, make it the first or only item.\n\n## How does it work?\n\nBy default, Django will store the password `password123` in a format similar to:\n\n```\npbkdf2_sha256$216000$gd57n4OWJrXh$Xs/TqhwJICOxsLONGlKXorjuWccooiuJmJOUaxbwcOQ=\n```\n\nThis is good for security as the password has been both salted and hashed before being saved into the database, making it almost impossible to retrieve the original password. This library however, stores the password as-is:\n\n```\nplaintext$$password123\n```\n\nThis makes searching by password possible, as well as comparing users passwords and allowing you to email users their passwords if they forget them - neat!\n\nIn addition to storing the values directly in the database for easy retrieval, the comparison is done simply with `==`, rather than using [`secrets.compare_digest`](https://docs.python.org/3/library/secrets.html#secrets.compare_digest).\n\n## Why?\n\nWell, why not?\n\nAlthough in all seriousness, If as part of your tests you're creating a large number of users, or just a couple users but you've got a lot of tests, you can get quite a performance improvement by simplifying the password hasher.\n\nUnfortunately due to a limitation (and feature) with Django, it's not possible to store just the value directly, it must be prefixed with the algorithm.\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "https://github.com/RealOrangeOne/django-plaintext-password",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/RealOrangeOne/django-plaintext-password"
    },
    "split_keywords": [
        "django",
        "password",
        "plaintext"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81feaf63904f72a48d78da8b4365644b61c5d5cc91d158b7c0c631180cbef695",
                "md5": "e673b8ed6520b7a7b5f30afe39320d10",
                "sha256": "9ad0a328c17fbd1553b980d948b23062bf6d496377379df20ba031a1e81df1df"
            },
            "downloads": -1,
            "filename": "django_plaintext_password-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e673b8ed6520b7a7b5f30afe39320d10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4717,
            "upload_time": "2023-05-12T15:31:48",
            "upload_time_iso_8601": "2023-05-12T15:31:48.791455Z",
            "url": "https://files.pythonhosted.org/packages/81/fe/af63904f72a48d78da8b4365644b61c5d5cc91d158b7c0c631180cbef695/django_plaintext_password-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ec1d17ff5bf814b274e1b3f4a230a2ee09d7d40e45c2ac5c032e9ecaa9a82dc",
                "md5": "b1218d71d7985522b2cd8f001a6a9c6e",
                "sha256": "737da67ae2ef2b13362e236a34a270a27288d74277339f4499517816fc26938d"
            },
            "downloads": -1,
            "filename": "django-plaintext-password-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b1218d71d7985522b2cd8f001a6a9c6e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4408,
            "upload_time": "2023-05-12T15:31:50",
            "upload_time_iso_8601": "2023-05-12T15:31:50.846678Z",
            "url": "https://files.pythonhosted.org/packages/4e/c1/d17ff5bf814b274e1b3f4a230a2ee09d7d40e45c2ac5c032e9ecaa9a82dc/django-plaintext-password-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 15:31:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RealOrangeOne",
    "github_project": "django-plaintext-password",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-plaintext-password"
}
        
Elapsed time: 0.06341s