django-better-passwords


Namedjango-better-passwords JSON
Version 0.1 PyPI version JSON
download
home_pagehttps://github.com/andrelccorrea/django-better-passwords
SummaryA Django app to provide tools to enforce stronger password policies and expiration.
upload_time2024-02-13 19:27:22
maintainer
docs_urlNone
authorAndré Corrêa
requires_python>=3.7
licenseBSD 3-Clause License Copyright (c) 2024, André Corrêa All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords password auth better expiration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Better Passwords

This app provides tools to enforce stronger password policies and expiration.

## Features

* Configurable password expiration;
* Customizable password validator;
* Uses Django messages framework to warn the user about the expiration;
* Prevents user from logging in after expiration and redirects to password change page;
* Compatible with default Django admin and Django CMS (django-cms) admin;
* Can be used to expire only staff passwords, or for all users;
* Force password update immediately after user creation.

## Requirements

Requires Python >= 3.6 and Django >=2.
Recommended Python 3.11 or 3.12 and Django 4.2 or 5.0;

## Quick start

1. Install the lib with `pip install django-better-passwords`.
2. Add `'django_better_passwords'` to `INSTALLED_APPS`.
3. Add `'django_better_passwords.middleware.PasswordExpirationMiddleware'` to `MIDDLEWARE`. <br>It should be listed after authentication, session and message middlewares, like this:
   ```python
   MIDDLEWARE = [
      "django.middleware.security.SecurityMiddleware",
      "django.contrib.sessions.middleware.SessionMiddleware",
      "django.middleware.common.CommonMiddleware",
      "django.middleware.csrf.CsrfViewMiddleware",
      "django.contrib.auth.middleware.AuthenticationMiddleware",
      "django.contrib.messages.middleware.MessageMiddleware",
      "django_better_passwords.middleware.PasswordExpirationMiddleware",
      "django.middleware.clickjacking.XFrameOptionsMiddleware",
   ]
   ```
4. Add `'django_better_passwords.validators.custom_password_validator.CustomPasswordValidator'` to `AUTH_PASSWORD_VALIDATORS`.<br>
Comment out or remove `'django.contrib.auth.password_validation.MinimumLengthValidator'` to avoid conflicting:
   ```python
   AUTH_PASSWORD_VALIDATORS = [
      ...
      # {
      #     "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
      # },
      {
         "NAME": "django_better_passwords.validators.custom_password_validator.CustomPasswordValidator",
         "OPTIONS": {
               "min_length": 8,
               "max_length": 20,
               "required_characters": "!#$%^&*()_+{}[]:\"-=,./<>?",
               "forbidden_characters": "@",
         },
      },
   ]
   ```
5. The validator accepts 4 parameters, being:
   1. `min_length (int)`: the minimum password length;
   2. `max_length (int)`: the maximum password length;
   3. `required_characters (str)`: a string containing a list of characters of which at least one must be present in the password;
   4. `forbidden_characters (str)`: a string containing a list of characters none of which can be present in the password;
6. Aditional app settings:
   ```python
   DBP_PASSWORD_EXPIRATION_DAYS = 60
   DBP_PASSWORD_CHANGE_REDIRECT_URL = "password_change"
   DBP_LOGOUT_URL = "logout"
   ```
   <span style="color:tomato">Attention</span>: If `DBP_PASSWORD_CHANGE_REDIRECT_URL` is present, when a user tries
   to log in or navigate to any url, he will be redirected to the `password_change` page.
   If it is not present, only users who try to access the admin area will be redirected.

## Contributing

We use pre-commit paired with black, flake8 and isort to keep things in their rightful place.

After cloning the project:

* Create and activate a venv;
* Install pip-tools;
* Run `pip-compile requirements.in` and `pip-sync requirements.txt` to install dependencies;
* Run `pre-commit install -f` to install pre-commit hook. It will create a **git hook**, that will **run automatically before every commit**;

## Acknowledgements

This app is inspired by [django-password-policies-iplweb](https://github.com/iplweb/django-password-policies-iplweb) and [django-password-expire](https://pypi.org/project/django-password-expire/).

### Author

André Corrêa - andre.lccorrea@gmail.com

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/andrelccorrea/django-better-passwords",
    "name": "django-better-passwords",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Andr\u00e9 Corr\u00eaa <andre.lcosta@hotmail.com>",
    "keywords": "password,auth,better,expiration",
    "author": "Andr\u00e9 Corr\u00eaa",
    "author_email": "Andr\u00e9 Corr\u00eaa <andre.lcosta@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/06/f85025ff0823645ce2b9e71d866ab14f1aad93d1920c12547a6ff45999a2/django-better-passwords-0.1.tar.gz",
    "platform": null,
    "description": "# Django Better Passwords\n\nThis app provides tools to enforce stronger password policies and expiration.\n\n## Features\n\n* Configurable password expiration;\n* Customizable password validator;\n* Uses Django messages framework to warn the user about the expiration;\n* Prevents user from logging in after expiration and redirects to password change page;\n* Compatible with default Django admin and Django CMS (django-cms) admin;\n* Can be used to expire only staff passwords, or for all users;\n* Force password update immediately after user creation.\n\n## Requirements\n\nRequires Python >= 3.6 and Django >=2.\nRecommended Python 3.11 or 3.12 and Django 4.2 or 5.0;\n\n## Quick start\n\n1. Install the lib with `pip install django-better-passwords`.\n2. Add `'django_better_passwords'` to `INSTALLED_APPS`.\n3. Add `'django_better_passwords.middleware.PasswordExpirationMiddleware'` to `MIDDLEWARE`. <br>It should be listed after authentication, session and message middlewares, like this:\n   ```python\n   MIDDLEWARE = [\n      \"django.middleware.security.SecurityMiddleware\",\n      \"django.contrib.sessions.middleware.SessionMiddleware\",\n      \"django.middleware.common.CommonMiddleware\",\n      \"django.middleware.csrf.CsrfViewMiddleware\",\n      \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n      \"django.contrib.messages.middleware.MessageMiddleware\",\n      \"django_better_passwords.middleware.PasswordExpirationMiddleware\",\n      \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n   ]\n   ```\n4. Add `'django_better_passwords.validators.custom_password_validator.CustomPasswordValidator'` to `AUTH_PASSWORD_VALIDATORS`.<br>\nComment out or remove `'django.contrib.auth.password_validation.MinimumLengthValidator'` to avoid conflicting:\n   ```python\n   AUTH_PASSWORD_VALIDATORS = [\n      ...\n      # {\n      #     \"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\",\n      # },\n      {\n         \"NAME\": \"django_better_passwords.validators.custom_password_validator.CustomPasswordValidator\",\n         \"OPTIONS\": {\n               \"min_length\": 8,\n               \"max_length\": 20,\n               \"required_characters\": \"!#$%^&*()_+{}[]:\\\"-=,./<>?\",\n               \"forbidden_characters\": \"@\",\n         },\n      },\n   ]\n   ```\n5. The validator accepts 4 parameters, being:\n   1. `min_length (int)`: the minimum password length;\n   2. `max_length (int)`: the maximum password length;\n   3. `required_characters (str)`: a string containing a list of characters of which at least one must be present in the password;\n   4. `forbidden_characters (str)`: a string containing a list of characters none of which can be present in the password;\n6. Aditional app settings:\n   ```python\n   DBP_PASSWORD_EXPIRATION_DAYS = 60\n   DBP_PASSWORD_CHANGE_REDIRECT_URL = \"password_change\"\n   DBP_LOGOUT_URL = \"logout\"\n   ```\n   <span style=\"color:tomato\">Attention</span>: If `DBP_PASSWORD_CHANGE_REDIRECT_URL` is present, when a user tries\n   to log in or navigate to any url, he will be redirected to the `password_change` page.\n   If it is not present, only users who try to access the admin area will be redirected.\n\n## Contributing\n\nWe use pre-commit paired with black, flake8 and isort to keep things in their rightful place.\n\nAfter cloning the project:\n\n* Create and activate a venv;\n* Install pip-tools;\n* Run `pip-compile requirements.in` and `pip-sync requirements.txt` to install dependencies;\n* Run `pre-commit install -f` to install pre-commit hook. It will create a **git hook**, that will **run automatically before every commit**;\n\n## Acknowledgements\n\nThis app is inspired by [django-password-policies-iplweb](https://github.com/iplweb/django-password-policies-iplweb) and [django-password-expire](https://pypi.org/project/django-password-expire/).\n\n### Author\n\nAndr\u00e9 Corr\u00eaa - andre.lccorrea@gmail.com\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2024, Andr\u00e9 Corr\u00eaa All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "A Django app to provide tools to enforce stronger password policies and expiration.",
    "version": "0.1",
    "project_urls": {
        "Homepage": "https://github.com/andrelccorrea/django-better-passwords"
    },
    "split_keywords": [
        "password",
        "auth",
        "better",
        "expiration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e393a9384659733b7c8871d6473fd9b4bcac3df79952e0baf863917fbb0d06b1",
                "md5": "f66152d9806c6daacd6d79ef2b1d5707",
                "sha256": "bcf9d48f395c88778b84a824b9a4d7fc2fee2a5b82f51f6d598591529cdfac43"
            },
            "downloads": -1,
            "filename": "django_better_passwords-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f66152d9806c6daacd6d79ef2b1d5707",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10696,
            "upload_time": "2024-02-13T19:27:20",
            "upload_time_iso_8601": "2024-02-13T19:27:20.628575Z",
            "url": "https://files.pythonhosted.org/packages/e3/93/a9384659733b7c8871d6473fd9b4bcac3df79952e0baf863917fbb0d06b1/django_better_passwords-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1106f85025ff0823645ce2b9e71d866ab14f1aad93d1920c12547a6ff45999a2",
                "md5": "e2b997b606e385532cf404ad2861fb89",
                "sha256": "09491872962648a634f9a891b8fe495d4cec4969a3f8e6f3d85045a7ee16e82c"
            },
            "downloads": -1,
            "filename": "django-better-passwords-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e2b997b606e385532cf404ad2861fb89",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10874,
            "upload_time": "2024-02-13T19:27:22",
            "upload_time_iso_8601": "2024-02-13T19:27:22.882236Z",
            "url": "https://files.pythonhosted.org/packages/11/06/f85025ff0823645ce2b9e71d866ab14f1aad93d1920c12547a6ff45999a2/django-better-passwords-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-13 19:27:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andrelccorrea",
    "github_project": "django-better-passwords",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "django-better-passwords"
}
        
Elapsed time: 0.18658s