auth.password_validation.UserAttributeSimilarityValidator

class UserAttributeSimilarityValidator(user_attributes=DEFAULT_USER_ATTRIBUTES, max_similarity=0.7) [source] Validates whether the password is sufficiently different from certain attributes of the user. The user_attributes parameter should be an iterable of names of user attributes to compare to. If this argument is not provided, the default is used: 'username', 'first_name', 'last_name', 'email'. Attributes that don’t exist are ignored. The maximum similarity the password can have, before i

auth.password_validation.password_validators_help_text_html()

password_validators_help_text_html(password_validators=None) Returns an HTML string with all help texts in an <ul>. This is helpful when adding password validation to forms, as you can pass the output directly to the help_text parameter of a form field.

auth.password_validation.password_validators_help_texts()

password_validators_help_texts(password_validators=None) [source] Returns a list of the help texts of all validators. These explain the password requirements to the user.

auth.password_validation.password_changed()

password_changed(password, user=None, password_validators=None) [source] Informs all validators that the password has been changed. This can be used by validators such as one that prevents password reuse. This should be called once the password has been successfully changed. For subclasses of AbstractBaseUser, the password field will be marked as “dirty” when calling set_password() which triggers a call to password_changed() after the user is saved.

auth.password_validation.NumericPasswordValidator

class NumericPasswordValidator [source] Validates whether the password is not entirely numeric.

auth.password_validation.MinimumLengthValidator

class MinimumLengthValidator(min_length=8) [source] Validates whether the password meets a minimum length. The minimum length can be customized with the min_length parameter.

auth.password_validation.get_password_validators()

get_password_validators(validator_config) [source] Returns a set of validator objects based on the validator_config parameter. By default, all functions use the validators defined in AUTH_PASSWORD_VALIDATORS, but by calling this function with an alternate set of validators and then passing the result into the password_validators parameter of the other functions, your custom set of validators will be used instead. This is useful when you have a typical set of validators to use for most scenar

auth.password_validation.CommonPasswordValidator

class CommonPasswordValidator(password_list_path=DEFAULT_PASSWORD_LIST_PATH) [source] Validates whether the password is not a common password. By default, this checks against a list of 1000 common password created by Mark Burnett. The password_list_path can be set to the path of a custom file of common passwords. This file should contain one password per line and may be plain text or gzipped.

auth.models.UserManager.create_user()

create_user(username, email=None, password=None, **extra_fields) Creates, saves and returns a User. The username and password are set as given. The domain portion of email is automatically converted to lowercase, and the returned User object will have is_active set to True. If no password is provided, set_unusable_password() will be called. The extra_fields keyword arguments are passed through to the User’s __init__ method to allow setting arbitrary fields on a custom User model. See Creatin

auth.models.UserManager.create_superuser()

create_superuser(username, email, password, **extra_fields) Same as create_user(), but sets is_staff and is_superuser to True.