recordtransfer.validators - Password validation

class recordtransfer.validators.LengthRangeValidator(min_length: int = 10, max_length: int = 30)

Bases: object

Validate that a password length falls within an inclusive range.

Django ships a MinimumLengthValidator but does not enforce an upper bound.

validate(password: str, user: None = None) None

Validate that the password length is within the specified min and max range.

get_help_text() str

Return help text describing the required password length range.

class recordtransfer.validators.CharacterCategoriesValidator(allowed_specials: str = '_#%().^{}!', required_categories: int = 3)

Bases: object

Require at least N of the defined character categories. Categories used here: - Uppercase (A-Z) - Lowercase (a-z) - Digits (0-9) - Special characters from the allowed set: _ # % ( ) . ^ { } !.

validate(password: str, user: None = None) None

Validate that the password contains at least the required number of character categories.

get_help_text() str

Return help text describing the required character categories for the password.

class recordtransfer.validators.PasswordHistoryValidator(history_depth: int = 5)

Bases: object

Ensure the new password is different from the user’s previous N passwords.

validate(password: str, user: User) None

Validate that the password is not in the user’s recent password history.

get_help_text() str

Return help text describing the password history requirement.

class recordtransfer.validators.ContainsUserNameValidator

Bases: object

Reject passwords that contain the full first name, last name, or username (case-insensitive). Email is intentionally ignored.

user_attributes: tuple = ('username', 'first_name', 'last_name')
get_user_attribute_values(user: User) list[str]

Get the values of the user attributes.

validate(password: str, user: User | None = None) None

Validate that the password does not contain the user’s first name, last name, or username.

get_help_text() str

Return help text describing the user attribute requirement.