Table of Contents

Class PasswordComplexityDigitsAttribute

Namespace
NuvTools.Validation.Annotations
Assembly
NuvTools.Validation.dll

Validation attribute that ensures a password contains a minimum number of digits (0-9).

public class PasswordComplexityDigitsAttribute : PasswordComplexityBaseAttribute
Inheritance
PasswordComplexityDigitsAttribute
Inherited Members
Extension Methods

Examples

public class UserModel
{
    [PasswordComplexityDigits(2)]
    public string Password { get; set; }
}

Constructors

PasswordComplexityDigitsAttribute(int)

Validation attribute that ensures a password contains a minimum number of digits (0-9).

public PasswordComplexityDigitsAttribute(int minOccurrences)

Parameters

minOccurrences int

The minimum number of digits required in the password.

Examples

public class UserModel
{
    [PasswordComplexityDigits(2)]
    public string Password { get; set; }
}

Methods

IsValid(object?)

Validates that the value contains at least the minimum number of digits.

public override bool IsValid(object? value)

Parameters

value object

The password value to validate.

Returns

bool

True if the password contains enough digits or if the value is null/empty; otherwise, false.