mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #16860 -- Added password validation to django.contrib.auth.
This commit is contained in:
@@ -25,7 +25,45 @@ Python 3.2 and added support for Python 3.5.
|
||||
What's new in Django 1.9
|
||||
========================
|
||||
|
||||
...
|
||||
Password validation
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Django now offers password validation, to help prevent the usage of weak
|
||||
passwords by users. The validation is integrated in the included password
|
||||
change and reset forms and is simple to integrate in any other code.
|
||||
Validation is performed by one or more validators, configured in the new
|
||||
:setting:`AUTH_PASSWORD_VALIDATORS` setting.
|
||||
|
||||
Four validators are included in Django, which can enforce a minimum length,
|
||||
compare the password to the user's attributes like their name, ensure
|
||||
passwords aren't entirely numeric or check against an included list of common
|
||||
passwords. You can combine multiple validators, and some validators have
|
||||
custom configuration options. For example, you can choose to provide a custom
|
||||
list of common passwords. Each validator provides a help text to explain their
|
||||
requirements to the user.
|
||||
|
||||
By default, no validation is performed and all passwords are accepted, so if
|
||||
you don't set :setting:`AUTH_PASSWORD_VALIDATORS`, you will not see any
|
||||
change. In new projects created with the default :djadmin:`startproject`
|
||||
template, a simple set of validators is enabled. To enable basic validation in
|
||||
the included auth forms for your project, you could set, for example::
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
See :ref:`password-validation` for more details.
|
||||
|
||||
Minor features
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user