setStrength method

PasswordValidator setStrength(
  1. PasswordStrength strength
)

Sets the strength of the password using the PasswordStrength

Implementation

PasswordValidator setStrength(PasswordStrength strength) {
  switch (strength) {
    case PasswordStrength.weak:
      minLength = 6;
      break;
    case PasswordStrength.medium:
      requireDigit = true;
      minLength = 8;
      break;
    case PasswordStrength.strong:
      requireDigit = true;
      requireUppercase = true;
      requireLowercase = true;
      requireSymbol = true;
      minLength = 12;
      break;
  }
  return this;
}