using System.Text.RegularExpressions;
namespace Business.KftcPasswordRule
{
///
///
public class AtLeastOneLowerCaseRule : PasswordRule
{
private string pattern = "[a-z]";
///
///
///
///
public PasswordValidationResult Validate(ValidationModel model)
{
if (model == null)
{
return new PasswordValidationResult { IsValid = false, Message = "Invalid password.Atleast one lowercase required. " };
}
if (string.IsNullOrEmpty(model.Password))
{
return new PasswordValidationResult { IsValid = false, Message = "Invalid password.Atleast one lowercase required. " };
}
var res = Regex.Matches(model.Password, pattern);
if (res.Count > 0)
{
return new PasswordValidationResult { IsValid = true, Message = "valid" };
}
return new PasswordValidationResult { IsValid = false, Message = "invalid password.Atleast one lowercase required." };
}
}
}