Skip to main content

MinimumLengthValidator

Validate that the password is of a minimum length.

Attributes

AttributeTypeDescription
min_lengthint = 8The minimum number of characters required for a password to be considered valid.

Constructor

Signature

def MinimumLengthValidator(
min_length: int = 8
) - > null

Parameters

NameTypeDescription
min_lengthint = 8The minimum number of characters required for a password to be considered valid.

Signature

def MinimumLengthValidator(
min_length: int = 8
) - > null

Parameters

NameTypeDescription
min_lengthint = 8The minimum number of characters required for a password to be considered valid

Methods


validate()

@classmethod
def validate(
password: string,
user: object = null
) - > null

Validate that the password is of a minimum length.

Parameters

NameTypeDescription
passwordstringThe raw password string to be evaluated for length compliance
userobject = nullThe user object associated with the password, though not used in this specific validation logic

Returns

TypeDescription
nullNone if validation passes; otherwise raises a ValidationError

get_error_message()

@classmethod
def get_error_message() - > string

Constructs a localized error message indicating that the password does not meet the minimum length requirement.

Returns

TypeDescription
stringA translated string explaining the length requirement, formatted with the specific minimum length

get_help_text()

@classmethod
def get_help_text() - > string

Provides a localized hint to be displayed in UI forms to inform users of the password length requirement.

Returns

TypeDescription
stringA translated instructional string stating the minimum number of characters required