module documentation

Undocumented

Class CommonPasswordValidator Validate that the password is not a common password.
Class MinimumLengthValidator Validate that the password is of a minimum length.
Class NumericPasswordValidator Validate that the password is not entirely numeric.
Class UserAttributeSimilarityValidator Validate that the password is sufficiently different from the user's attributes.
Function exceeds_maximum_length_ratio Test that value is within a reasonable range of password.
Function get_default_password_validators Undocumented
Function get_password_validators Undocumented
Function password_changed Inform all validators that have implemented a password_changed() method that the password has been changed.
Function password_validators_help_texts Return a list of all help texts of all configured validators.
Function validate_password Validate that the password meets all validator requirements.
Variable password_validators_help_text_html Undocumented
Function _password_validators_help_text_html Return an HTML string with all help texts of all configured validators in an <ul>.
def exceeds_maximum_length_ratio(password, max_similarity, value): (source)

Test that value is within a reasonable range of password. The following ratio calculations are based on testing SequenceMatcher like this: for i in range(0,6): print(10**i, SequenceMatcher(a='A', b='A'*(10**i)).quick_ratio()) which yields: 1 1.0 10 0.18181818181818182 100 0.019801980198019802 1000 0.001998001998001998 10000 0.00019998000199980003 100000 1.999980000199998e-05 This means a length_ratio of 10 should never yield a similarity higher than 0.2, for 100 this is down to 0.02 and for 1000 it is 0.002. This can be calculated via 2 / length_ratio. As a result we avoid the potentially expensive sequence matching.

@functools.lru_cache(maxsize=None)
def get_default_password_validators(): (source)

Undocumented

def get_password_validators(validator_config): (source)

Undocumented

def password_changed(password, user=None, password_validators=None): (source)

Inform all validators that have implemented a password_changed() method that the password has been changed.

def password_validators_help_texts(password_validators=None): (source)

Return a list of all help texts of all configured validators.

def validate_password(password, user=None, password_validators=None): (source)

Validate that the password meets all validator requirements. If the password is valid, return ``None``. If the password is invalid, raise ValidationError with all error messages.

password_validators_help_text_html = (source)

Undocumented

def _password_validators_help_text_html(password_validators=None): (source)

Return an HTML string with all help texts of all configured validators in an <ul>.