diff --git a/README.rst b/README.rst index 6151700..4217c07 100644 --- a/README.rst +++ b/README.rst @@ -4,13 +4,58 @@ :alt: CI status image :target: https://github.com/ubernostrum/pwned-passwords-django/actions?query=workflow%3ACI -pwned-passwords-django provides helpers for working with the `Pwned -Passwords database of Have I Been Pwned +``pwned-passwords-django`` provides helpers for working with the +`Pwned Passwords database of Have I Been Pwned `_ in `Django `_ powered sites. Pwned Passwords is an extremely large database of passwords known to have been compromised through data breaches, and is useful as a tool for rejecting common or weak passwords. -Documentation is `available online +There are three main components to this application: + +* A password validator which integrates with `Django's + password-validation tools + `_ + and checks the Pwned Passwords database. + +* A Django middleware (supporting both sync and async requests) which + automatically checks certain request payloads against the Pwned + Passwords database. + +* An API client providing direct access (both sync and async) to the + Pwned Passwords database. + +All three use a secure, anonymized API which never transmits any +password or its full hash to any third party. + + +Usage +----- + +The recommended default configuration is to enable both the validator +and the automatic password-checking middleware. To do this, make the +following changes to your Django settings. + +First, add the validator to your AUTH_PASSWORD_VALIDATORS list: + +.. code-block:: python + + AUTH_PASSWORD_VALIDATORS = [ + # ... other password validators ... + { + "NAME": "pwned_passwords_django.validators.PwnedPasswordsValidator", + }, + ] + +Then, the middleware to your MIDDLEWARE list: + +.. code-block:: python + + MIDDLEWARE = [ + # .. other middlewares ... + "pwned_passwords_django.middleware.pwned_passwords_middleware", + ] + +For more details, consult `the full documentation `_. diff --git a/docs/index.rst b/docs/index.rst index 89a94d3..bd3974f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,28 +1,59 @@ -pwned-passwords-django |release| -================================== +``pwned-passwords-django`` |release| +==================================== -pwned-passwords-django provides helpers for working with the `Pwned +``pwned-passwords-django`` provides helpers for working with the `Pwned Passwords database of Have I Been Pwned `_ in `Django -`_ powered sites. Pwned Passwords is -an extremely large database of passwords known to have been -compromised through data breaches, and is useful as a tool for -rejecting common or weak passwords. +`_ powered sites. Pwned Passwords is an +extremely large database of passwords known to have been compromised through +data breaches, and is useful as a tool for rejecting common or weak passwords. There are three main components to this application: -* :ref:`A password validator ` which checks the Pwned - Passwords database. +* :ref:`A password validator ` which integrates with `Django's + password-validation tools + `_ + and checks the Pwned Passwords database. -* :ref:`A middleware ` which automatically checks certain - request payloads against the Pwned Passwords database. +* :ref:`A Django middleware ` (supporting both sync and async + requests) which automatically checks certain request payloads against the + Pwned Passwords database. -* :ref:`Code providing direct access ` to the Pwned Passwords - database. +* :ref:`An API client ` providing direct access (both sync and async) to + the Pwned Passwords database. -All three use a secure, anonymized API which never transmits the -password or its hash to any third party. To learn more, see :ref:`the -FAQ `. +All three use a secure, anonymized API which never transmits any password or +its full hash to any third party. To learn more, see :ref:`the FAQ `. + + +Usage +----- + +The recommended default configuration is to enable both :ref:`the password +validator ` and :ref:`the automatic password-checking middleware +`. To do this, make the following changes to your Django settings. + +First, add :ref:`the validator ` to your +:setting:`AUTH_PASSWORD_VALIDATORS` list: + +.. code-block:: python + + AUTH_PASSWORD_VALIDATORS = [ + # ... other password validators ... + { + "NAME": "pwned_passwords_django.validators.PwnedPasswordsValidator", + }, + ] + +Then, add :ref:`the middleware ` to your :setting:`MIDDLEWARE` +list: + +.. code-block:: python + + MIDDLEWARE = [ + # .. other middlewares ... + "pwned_passwords_django.middleware.pwned_passwords_middleware", + ] Documentation contents