resolvePasswordValidationIssue function

String resolvePasswordValidationIssue(
  1. PasswordValidationIssue issue
)

Default English messages for password validation issues.

Implementation

String resolvePasswordValidationIssue(PasswordValidationIssue issue) {
  return switch (issue) {
    PasswordEmptyIssue() => 'Password is required',
    PasswordTooShortIssue(:final minLength) => 'Minimum $minLength characters',
    PasswordTooLongIssue(:final maxLength) => 'Maximum $maxLength characters',
    PasswordMissingUppercaseIssue() => 'At least one uppercase letter',
    PasswordMissingLowercaseIssue() => 'At least one lowercase letter',
    PasswordMissingDigitIssue() => 'At least one number',
    PasswordMissingSpecialCharacterIssue() => 'At least one special character',
    PasswordTooCommonIssue() => 'Password is too common',
    PasswordRepeatedCharacterIssue() => 'Password is too predictable',
    PasswordSequentialPatternIssue() => 'Password is too predictable',
  };
}