Beispiel #1
0
        public RegisterModelValidator(IdentityContext identityContext)
        {
            RuleFor(x => x.Name).NotEmpty()
            .Must(name => !identityContext.Users.Any(u => u.Name == name))
            .WithMessage(x => $"Username {x.Name} is already taken");

            RuleFor(x => x.Email).NotEmpty().EmailAddress();
            RuleFor(x => x.Password).NotEmpty();
        }
Beispiel #2
0
 public UserService(IdentityContext context, IConfiguration configuration, IMapper mapper,
                    IValidator <RegisterUserCommand> registerModelValidator,
                    IValidator <AuthenticateUserCommand> authenticateModelValidator)
 {
     _context                    = context;
     _configuration              = configuration;
     _mapper                     = mapper;
     _registerModelValidator     = registerModelValidator;
     _authenticateModelValidator = authenticateModelValidator;
 }
 public ApplicationRoleStore(IdentityContext context)
 {
     _context = context;
 }
 public ApplicationUserStore(IdentityContext context)
 {
     _context = context;
 }