Esempio n. 1
0
 public ExistingUsernameValidator(
     ICredentialRequirmentValidator credentialRequirmentValidator,
     IIdentityContext identityContext)
 {
     RuleFor(model => model)
     .MustAsync(async(model, token) => await identityContext.UsernameExists(model))
     .WithMessage((model, value) => $"Username {value} doesn't exists");
 }
Esempio n. 2
0
 public UniqueUsernameValidator(
     ICredentialRequirmentValidator credentialValidator,
     IIdentityContext identityContext)
 {
     RuleFor(model => model)
     .MustAsync(async(model, token) => !await identityContext.UsernameExists(model))
     .WithMessage((model, value) => $"Username: {value} is not available");
 }