django-password-policies provides validators to check new passwords:
Counts the occurrences of characters of a unicodedata.category() and raises a ValidationError if the count is less than get_min_count().
Returns the error message of this validator.
Returns the amount of required characters.
Compares a needle to a haystack (list of strings) and calculates a similarity between 0.0 and 1.0.
Raises a ValidationError if the similarity is greater than PASSWORD_MATCH_THRESHOLD.
A list of strings.
Returns: | password_policies.conf.Settings.PASSWORD_MATCH_THRESHOLD. |
---|
Bases: password_policies.forms.validators.BaseRFC4013Validator
Validates that
For more information read RFC 4013, section 2.3.
The validator’s error code.
The validator’s error message.
Bases: password_policies.forms.validators.BaseSimilarityValidator
Validates that a given password is not based on a common sequence of characters.
The validator’s error code.
The validator’s error message.
Returns: | password_policies.conf.Settings.PASSWORD_MATCH_THRESHOLD. |
---|
Validates that a given password does not contain consecutive characters.
The validator’s error code.
Returns: | password_policies.conf.Settings.PASSWORD_MAX_CONSECUTIVE |
---|
Validates a given password using Python bindings for cracklib.
The validator’s error code.
This argument will change the default of 10 for the number of characters in the new password that must not be present in the old password. In addition, if 1/2 of the characters in the new password are different then the new password will be accepted anyway.
The maximum credit for having digits in the new password.
The maximum credit for having lower case letters in the new password.
The minimum acceptable size for the new password (plus one if credits are not disabled which is the default).
The maximum credit for having other characters in the new password.
The maximum credit for having upper case letters in the new password.
Note
For additional informations please consult the Python bindings for cracklib documentation.
Bases: password_policies.forms.validators.BaseSimilarityValidator
Validates that a given password is not based on a dictionary word.
Note
If dictionary AND words are empty or set to None validation is not performed.
Warning
This validator is very time consuming and validation duration depends on the amount of lines in the dictionary file. The larger the dictionary file, the longer validation takes!
The validator’s error code.
The validator’s error message.
A path to a file with one word per line. Defaults to password_policies.conf.Settings.PASSWORD_DICTIONARY.
A list of unicode strings. Defaults to password_policies.conf.Settings.PASSWORD_WORDS.
Returns: | password_policies.conf.Settings.PASSWORD_MATCH_THRESHOLD. |
---|
Validates that a password contains varied characters by calculating the Shannon entropy of a password.
The validator’s error code.
Specifies the minimum entropy of long passwords (len(password) >= 100). Defaults to password_policies.conf.Settings.PASSWORD_MIN_ENTROPY_LONG.
If set to 0 validation will not be performed.
The validator’s error message.
Specifies the minimum entropy of short passwords (len(password) < 100). Defaults to password_policies.conf.Settings.PASSWORD_MIN_ENTROPY_SHORT.
If set to 0 validation will not be performed.
Bases: password_policies.forms.validators.BaseRFC4013Validator
Validates that a given password does not contain invalid unicode characters as defined in RFC 4013, section 2.3.
The validator’s error code.
The validator’s error message.
Bases: password_policies.forms.validators.BaseCountValidator
Counts the occurrences of letters and raises a ValidationError if the count is less than get_min_count().
The unicode data letter categories:
Code | Description |
---|---|
LC | Letter, Cased |
Ll | Letter, Lowercase |
Lu | Letter, Uppercase |
Lt | Letter, Titlecase |
Lo | Letter, Other |
Nl | Number, Letter |
The validator’s error code.
Returns this validator’s error message.
Returns: | password_policies.conf.Settings.PASSWORD_MIN_LETTERS |
---|
Bases: password_policies.forms.validators.BaseCountValidator
Counts the occurrences of numbers (digits, etc.) and raises a ValidationError if the count is less than get_min_count().
The unicode data number categories:
Code | Description |
---|---|
Nd | Number, Decimal Digit |
No | Number, Other |
The validator’s error code.
Returns this validator’s error message.
Returns: | password_policies.conf.Settings.PASSWORD_MIN_NUMBERS |
---|
Bases: password_policies.forms.validators.BaseCountValidator
Counts the occurrences of other characters than letters and numbers, except line breaks, and raises a ValidationError if the count is less than get_min_count().
The unicode data symbol categories:
Code | Description |
---|---|
Lm | Letter, Modifier |
Mc | Mark, Spacing Combining |
Me | Mark, Enclosing |
Mn | Mark, Nonspacing |
Pc | Punctuation, Connector |
Pd | Punctuation, Dash |
Pe | Punctuation, Close |
Pf | Punctuation, Final quote (may behave like Ps or Pe depending on usage) |
Pi | Punctuation, Initial quote (may behave like Ps or Pe depending on usage) |
Po | Punctuation, Other |
Ps | Punctuation, Open |
Sc | Symbol, Currency |
Sk | Symbol, Modifier |
Sm | Symbol, Math |
So | Symbol, Other |
Zl | Separator, Line |
The validator’s error code.
Returns this validator’s error message.
Returns: | password_policies.conf.Settings.PASSWORD_MIN_SYMBOLS |
---|
A BidirectionalValidator instance.
A CommonSequenceValidator instance.
A ConsecutiveCountValidator instance.
A CracklibValidator instance.
A DictionaryValidator instance.
A EntropyValidator instance.
A InvalidCharacterValidator instance.
A LetterCountValidator instance.
A NotEmailValidator instance.
A NumberCountValidator instance.
A SymbolCountValidator instance.