Exemple #1
0
        public CaptchaValidator(ICaptchaService captcha)
        {
            _captcha = captcha;

            RuleFor(x => x.Code).NotEmpty().WithMessage("Captcha is required")
            .Must((x, code) => _captcha.Ishuman(x.Id, x.Code)).WithMessage("Invalid Captcha");
        }
Exemple #2
0
 public BlogController(ILogger <BlogController> logger, IPostService postService, IPageService pageService, ICategoryService categoryService, ITagsService tagsService, ICommentService commentService, IPostFactory postFactory, IPageFactory pageFactory, ICategoryFactory categoryFactory, ITagsFactory tagsFactory, BlogUserManager blogUserManager, IUserFactory userFactory, CommentsSettings commentsSettings, ICaptchaService captchaService, IHttpContextAccessor httpContextAccessor, IIPAddressService iPAddressService, IEmailSender emailSender, IJsonSerializer jsonSerializer, IStringLocalizer <BlogController> stringLocalizer, ISpamService spamService, IEventBus eventBus, BasicSettings basicSettings, IDistributedCache distributedCache)
 {
     _logger              = logger;
     _postService         = postService;
     _pageService         = pageService;
     _categoryService     = categoryService;
     _tagsService         = tagsService;
     _commentService      = commentService;
     _postFactory         = postFactory;
     _pageFactory         = pageFactory;
     _categoryFactory     = categoryFactory;
     _tagsFactory         = tagsFactory;
     _blogUserManager     = blogUserManager;
     _userFactory         = userFactory;
     _commentsSettings    = commentsSettings;
     _captchaService      = captchaService;
     _httpContextAccessor = httpContextAccessor;
     _iPAddressService    = iPAddressService;
     _emailSender         = emailSender;
     _jsonSerializer      = jsonSerializer;
     _stringLocalizer     = stringLocalizer;
     _spamService         = spamService;
     _eventBus            = eventBus;
     _basicSettings       = basicSettings;
     _distributedCache    = distributedCache;
 }
 public ChangePasswordValidator(ICaptchaService captcha) : base(captcha)
 {
     RuleFor(x => x.Token).NotEmpty().WithMessage("An error occurred, please try again later");
     RuleFor(x => x.UserId).NotEmpty().WithMessage("An error occurred, please try again later");
     RuleFor(x => x.Password).NotEmpty().WithMessage("Password is required");
     // .Must(CommonValidation.BeAValidPassword).WithMessage(CommonValidation.ValidPasswordErrorMessage);
 }
        /// <summary>
        ///     Initiate controller with injectors.
        /// </summary>
        /// <param name="unitOfWork"></param>
        /// <param name="mapper"></param>
        /// <param name="baseTimeService"></param>
        /// <param name="relationalDbService"></param>
        /// <param name="encryptionService"></param>
        /// <param name="profileService"></param>
        /// <param name="systemBaseTimeService"></param>
        /// <param name="externalAuthenticationService"></param>
        /// <param name="sendMailService"></param>
        /// <param name="emailCacheService"></param>
        /// <param name="jwtConfigurationOptions"></param>
        /// <param name="applicationSettings"></param>
        /// <param name="logger"></param>
        /// <param name="vgyService"></param>
        /// <param name="profileCacheService"></param>
        /// <param name="captchaService"></param>
        /// <param name="realTimeService"></param>
        /// <param name="userDomain"></param>
        public UserController(
            IAppUnitOfWork unitOfWork,
            IMapper mapper,
            IBaseTimeService baseTimeService,
            IBaseRelationalDbService relationalDbService,
            IBaseEncryptionService encryptionService,
            IAppProfileService profileService,
            IBaseTimeService systemBaseTimeService,
            IExternalAuthenticationService externalAuthenticationService,
            ISendMailService sendMailService,
            IEmailCacheService emailCacheService,
            IOptions <AppJwtModel> jwtConfigurationOptions,
            IOptions <ApplicationSetting> applicationSettings,
            ILogger <UserController> logger,
            IVgyService vgyService,
            IBaseKeyValueCacheService <int, User> profileCacheService,
            ICaptchaService captchaService,

            IUserDomain userDomain) : base(
                unitOfWork, mapper, baseTimeService,
                relationalDbService, profileService)
        {
            _logger            = logger;
            _profileService    = profileService;
            _sendMailService   = sendMailService;
            _emailCacheService = emailCacheService;
            _captchaService    = captchaService;

            _userDomain = userDomain;
        }
Exemple #5
0
 public void Configure(NetworkServicesConfig config)
 {
     if (clubPenguinClient != null)
     {
         clubPenguinClient.Destroy();
     }
     clubPenguinClient = new ClubPenguinClient(monoBehaviour, config.CPAPIServicehost, config.CPAPIClientToken, config.ClientApiVersion, config.CPGameServerZone, !offlineMode && config.CPGameServerEncrypted, config.CPGameServerDebug, config.CPLagMonitoring, config.CPGameServerLatencyWindowSize, config.CPWebServiceLatencyWindowSize, config.CPMonitoringServicehost, config.CPWebsiteAPIServicehost, offlineMode);
     currentConfig     = config;
     worldService      = new WorldService();
     worldService.Initialize(clubPenguinClient);
     playerStateService = new PlayerStateService();
     playerStateService.Initialize(clubPenguinClient);
     chatService = new ChatService();
     chatService.Initialize(clubPenguinClient);
     playerActionService = new PlayerActionService();
     playerActionService.Initialize(clubPenguinClient);
     iglooService = new IglooService();
     iglooService.Initialize(clubPenguinClient);
     inventoryService = new InventoryService();
     inventoryService.Initialize(clubPenguinClient);
     breadcrumbService = new BreadcrumbService();
     breadcrumbService.Initialize(clubPenguinClient);
     savedOutfitService = new SavedOutfitService();
     savedOutfitService.Initialize(clubPenguinClient);
     prototypeService = new PrototypeService();
     prototypeService.Initialize(clubPenguinClient);
     questService = new QuestService();
     questService.Initialize(clubPenguinClient);
     consumableService = new ConsumableService();
     consumableService.Initialize(clubPenguinClient);
     friendsService = new FriendsService();
     friendsService.Initialize(clubPenguinClient);
     rewardService = new RewardService();
     rewardService.Initialize(clubPenguinClient);
     taskService = new TaskNetworkService();
     taskService.Initialize(clubPenguinClient);
     minigameService = new MinigameService();
     minigameService.Initialize(clubPenguinClient);
     iapService = new IAPService();
     iapService.Initialize(clubPenguinClient);
     tutorialService = new TutorialService();
     tutorialService.Initialize(clubPenguinClient);
     moderationService = new ModerationService();
     moderationService.Initialize(clubPenguinClient);
     disneyStoreService = new DisneyStoreService();
     disneyStoreService.Initialize(clubPenguinClient);
     newsfeedService = new NewsfeedService();
     newsfeedService.Initialize(clubPenguinClient);
     catalogService = new CatalogService();
     catalogService.Initialize(clubPenguinClient);
     partyGameService = new PartyGameService();
     partyGameService.Initialize(clubPenguinClient);
     scheduledEventService = new ScheduledEventService();
     scheduledEventService.Initialize(clubPenguinClient);
     diagnosticsService = new DiagnosticsService();
     diagnosticsService.Initialize(clubPenguinClient);
     captchaService = new CaptchaService();
     captchaService.Initialize(clubPenguinClient);
 }
Exemple #6
0
 public Checker(ICaptchaService captchaService, IProxyManager proxyManager, IAccountManager accountManager)
 {
     _captchaService  = captchaService;
     _proxyManager    = proxyManager;
     _accountManager  = accountManager;
     _logger          = ServiceLocator.Current.GetInstance <ILogger>();
     _eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
 }
Exemple #7
0
 /// <summary>
 ///     Initiate controller with injectors.
 /// </summary>
 /// <param name="captchaService"></param>
 /// <param name="profileCacheService"></param>
 /// <param name="userDomain"></param>
 public UserController(
     ICaptchaService captchaService,
     IBaseKeyValueCacheService <int, User> profileCacheService,
     IUserDomain userDomain)
 {
     _captchaService = captchaService;
     _userDomain     = userDomain;
 }
Exemple #8
0
 public CommonController(ICaptchaService captchaService,
                         ISettingService settingService,
                         ICacheManager cacheManager)
 {
     this._captchaService = captchaService;
     this._settingService = settingService;
     this._cacheManager   = cacheManager;
 }
Exemple #9
0
 public Checker(ICaptchaService captchaService, IProxyManager proxyManager, IAccountManager accountManager)
 {
     _captchaService = captchaService;
     _proxyManager = proxyManager;
     _accountManager = accountManager;
     _logger = ServiceLocator.Current.GetInstance<ILogger>();
     _eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
 }
        public StateContext(ILogger logger, IProxyManager proxyManager, ICaptchaService captchaService)
        {
            _logger = logger;
            ProxyManager = proxyManager;
            CaptchaService = captchaService;

            _restartState = new RestartState(this);
            _validationState = new ValidationState(this);
        }
        public CaptchaServiceTests()
        {
            _service = TestServiceProvider.Current.GetRequiredService <ICaptchaService>();

            var now = DateTimeOffset.Now;

            _captchas = new string[] { now.ToString("yyyy"), now.ToString("HHmmss"), now.Ticks.ToString() };
            //var captcha = now.ToString("HHmmss");
        }
Exemple #12
0
        public StateContext(ILogger logger, IProxyManager proxyManager, ICaptchaService captchaService)
        {
            _logger        = logger;
            ProxyManager   = proxyManager;
            CaptchaService = captchaService;

            _restartState    = new RestartState(this);
            _validationState = new ValidationState(this);
        }
Exemple #13
0
        public async Task <FileContentResult> CaptchaAsync([FromServices] ICaptchaService _captchaServices)
        {
            //if (_captchaServices == null) throw new ArgumentNullException(nameof(_captchaServices), "ICaptchaServices未注入,请在CaptchaServices的属性ServiceLifetimeAttribute中启用");
            var code = await _captchaServices.GenerateRandomCaptchaAsync();

            var result = await _captchaServices.GenerateCaptchaImageAsync(code);

            return(File(result.CaptchaMemoryStream.ToArray(), "image/png"));
        }
        public CaptchaImageController(
            ICaptchaService captchaService,
            IOrchardServices orchardServices)
        {
            _captchaService  = captchaService;
            _orchardServices = orchardServices;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="appUserService"></param>
 /// <param name="httpContextAccessor"></param>
 /// <param name="userPermissionChecker"></param>
 /// <param name="emailSender"></param>
 /// <param name="imageFileService"></param>
 /// <param name="captchaService"></param>
 public AppUserControllerBase(IConfiguration configuration, IAppUserService appUserService, IHttpContextAccessor httpContextAccessor, IUserPermissionChecker userPermissionChecker, IEmailSender emailSender, IImageFileService imageFileService, ICaptchaService captchaService)
 {
     Configuration          = configuration;
     _appUserService        = appUserService;
     _userPermissionChecker = userPermissionChecker;
     _httpContextAccessor   = httpContextAccessor;
     _emailSender           = emailSender;
     _imageFileService      = imageFileService;
     _captchaService        = captchaService;
 }
Exemple #16
0
 public CreateUserCommandHandler(
     ICaptchaService captchaService,
     ApplicationDbContext dbContext,
     IPublishEndpoint publishEndpoint,
     IIdentityService identityService)
 {
     _dbContext       = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _captchaService  = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _publishEndpoint = publishEndpoint ?? throw new ArgumentNullException(nameof(publishEndpoint));
     _identityService = identityService ?? throw new ArgumentNullException(nameof(identityService));
 }
Exemple #17
0
        public SendResetPasswordCommand(IUserTokenGenerator userTokenGenerator, ICryptoService cryptoService,
                                        IEmailSender emailSender, IEmailTemplateGenerator emailTemplateGenerator, ICaptchaService captchaService,
                                        IConfiguration configuration)
        {
            this.userTokenGenerator     = userTokenGenerator;
            this.cryptoService          = cryptoService;
            this.emailSender            = emailSender;
            this.emailTemplateGenerator = emailTemplateGenerator;
            this.captchaService         = captchaService;

            Configuration = configuration;
        }
 public SendResetPasswordLinkCommandHandler(
     ICaptchaService captchaService,
     IBus bus,
     IIdentityClient identityClient,
     IQueryProcessor queryProcessor,
     OAuthConfiguration oAuthConfiguration)
 {
     _captchaService     = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _bus                = bus ?? throw new ArgumentNullException(nameof(bus));
     _identityClient     = identityClient ?? throw new ArgumentNullException(nameof(identityClient));
     _queryProcessor     = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
     _oAuthConfiguration = oAuthConfiguration;
 }
Exemple #19
0
 public RegisterModel(
     UserManager <IdentityUser> userManager,
     SignInManager <IdentityUser> signInManager,
     ILogger <RegisterModel> logger,
     IEmailSender emailSender,
     ICaptchaService captchaService)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _emailSender   = emailSender;
     _captcha       = captchaService;
 }
Exemple #20
0
 /// <summary>
 ///     Initalize controller with Injectors
 /// </summary>
 /// <param name="tokenService"></param>
 /// <param name="profileService"></param>
 /// <param name="captchaService"></param>
 /// <param name="fileService"></param>
 /// <param name="profileCacheService"></param>
 /// <param name="userService"></param>
 public ApiUserController(
     ITokenService tokenService, IProfileService profileService,
     ICaptchaService captchaService, IFileService fileService,
     IValueCacheService <string, ProfileModel> profileCacheService,
     IUserService userService)
 {
     _tokenService        = tokenService;
     _profileService      = profileService;
     _captchaService      = captchaService;
     _fileService         = fileService;
     _profileCacheService = profileCacheService;
     _userService         = userService;
 }
 public SendResetPasswordLinkCommandHandler(
     ICaptchaService captchaService,
     IPublishEndpoint publishEndpoint,
     IIdentityService identityService,
     IQueryProcessor queryProcessor,
     OAuthConfiguration oAuthConfiguration)
 {
     _captchaService     = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _publishEndpoint    = publishEndpoint ?? throw new ArgumentNullException(nameof(publishEndpoint));
     _identityService    = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _queryProcessor     = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
     _oAuthConfiguration = oAuthConfiguration;
 }
Exemple #22
0
 public AccountController(
     IIdentityService identityService,
     IUserAuthenticationService userAuthenticationService,
     ICaptchaService captchaService,
     IMapper mapper,
     IOptions <JwtOptions> jwtOptions)
 {
     _identityService           = identityService;
     _userAuthenticationService = userAuthenticationService;
     _captchaService            = captchaService;
     _mapper     = mapper;
     _jwtOptions = jwtOptions.Value;
 }
Exemple #23
0
 public QuestionnaireController(IOrchardServices orchardServices,
                                IQuestionnairesServices questionnairesServices,
                                ITransactionManager transactionManager,
                                IWorkflowManager workflowManager,
                                ICaptchaService captchaServices,
                                IShapeFactory shapeFactory)
 {
     _orchardServices        = orchardServices;
     _questionnairesServices = questionnairesServices;
     _transactionManager     = transactionManager;
     _captchaServices        = captchaServices;
     T = NullLocalizer.Instance;
     _workflowManager = workflowManager;
     Shape            = shapeFactory;
 }
Exemple #24
0
 public CreateUserCommandHandler(
     ICaptchaService captchaService,
     IBus bus,
     IIdentityClient identityClient,
     IQueryProcessor queryProcessor,
     IApplicationDbContextFactory dbContextFactory,
     ISabitClient sabitClient)
 {
     _captchaService   = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _bus              = bus ?? throw new ArgumentNullException(nameof(bus));
     _identityClient   = identityClient ?? throw new ArgumentNullException(nameof(identityClient));
     _queryProcessor   = queryProcessor;
     _dbContextFactory = dbContextFactory;
     _sabitClient      = sabitClient;
 }
        public SignUpValidator(IAuthRepository auth, ICaptchaService captcha) : base(captcha)
        {
            RuleFor(x => x.FirstName).NotEmpty().WithMessage("First Name is required");

            RuleFor(x => x.LastName).NotEmpty().WithMessage("Last Name is required");

            RuleFor(x => x.Password).NotEmpty().WithMessage("Password is required")
            .Must(CommonValidation.BeAValidPassword).WithMessage(CommonValidation.ValidPasswordErrorMessage);

            RuleFor(x => x.EmailAddress).NotEmpty().WithMessage("Email is required").EmailAddress().WithMessage("Email is invalid");

            RuleFor(x => x.EmailAddress).MustAsync(async(x, email, y) => await auth.EmailAvailable(x.EmailAddress))
            .WithMessage(x => $"{x.EmailAddress} has been taken");

            RuleFor(x => x.AgreeToTermsAndCondition).Equal(true).WithMessage("Agree to our terms and condition to continue");
        }
 public ChequerService(ApplicationDbContext context, IGrupoService grupoService, ILogger <ChequerService> log, ICaptchaService captchaService, IRegistroService registroService, IAnuncioService anuncioService, IManejadorFinancieroService financieroService, ITemporizadorService temporizadorService, IValidationService validationService, IEmailRandomService emailRandomService, IQueueService queueService)
 {
     _context = context;
     repositoryTemporizador = new Repository <Temporizador>(context);
     _removeRepository      = new Repository <RemoveQueue>(context);
     _grupoService          = grupoService;
     _log                 = log;
     _captchaService      = captchaService;
     _registroService     = registroService;
     _anuncioService      = anuncioService;
     _financieroService   = financieroService;
     _temporizadorService = temporizadorService;
     _validationService   = validationService;
     _emailRandomService  = emailRandomService;
     _queueService        = queueService;
 }
        public SignUpCommand(IAuthService authService, ISerialService serialService,
                             IReadOnlyUserService userService, IEmailSender emailSender, ICryptoService cryptoService,
                             IReadOnlyEmailTemplateGenerator emailTemplateGenerator, IAuthValidationService authValidationService,
                             ICaptchaService captchaService, IConfiguration configuration, IMapper mapper)
        {
            this.authService            = authService;
            this.serialService          = serialService;
            this.userService            = userService;
            this.emailSender            = emailSender;
            this.cryptoService          = cryptoService;
            this.emailTemplateGenerator = emailTemplateGenerator;
            this.authValidationService  = authValidationService;
            this.captchaService         = captchaService;
            this.mapper = mapper;

            Configuration = configuration;
        }
Exemple #28
0
 public QuestionnairePartDriver(IQuestionnairesServices questServices,
                                ICurrentContentAccessor currentContentAccessor,
                                IOrchardServices orchardServices,
                                IControllerContextAccessor controllerContextAccessor,
                                ICaptchaService capthcaServices,
                                ITokenizer tokenizer)
 {
     _questServices             = questServices;
     _orchardServices           = orchardServices;
     _controllerContextAccessor = controllerContextAccessor;
     T = NullLocalizer.Instance;
     _capthcaServices        = capthcaServices;
     _tokenizer              = tokenizer;
     _currentContentAccessor = currentContentAccessor;
     _isAuthorized           = new Lazy <bool>(() =>
                                               _orchardServices.Authorizer.Authorize(Permissions.SubmitQuestionnaire)
                                               );
 }
Exemple #29
0
        public Main()
        {
            InitializeComponent();

            var eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();

            eventAggregator.AddListener(this);

            _logger = ServiceLocator.Current.GetInstance <ILogger>();

            _captchaService = ServiceLocator.Current.GetInstance <ICaptchaService>();
            _proxyManager   = new LoggedProxyManager(new ProxyManager());
            _accountManager = new AccountManager();

            _accountsChecker = new Checker(_captchaService, _proxyManager, _accountManager);

            _accountsChecker.OnCheckCompleted += AccountsCheckerOnCheckCompleted;
        }
Exemple #30
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ILoggerFactory loggerFactory,
     IStatisticsManager statisticsManager,
     IEmailSender emailSender,
     IEmailManager emailManager,
     IOptions <AppSettings> appSettings,
     ICaptchaService captchaService)
 {
     _userManager       = userManager;
     _signInManager     = signInManager;
     _statisticsManager = statisticsManager;
     _emailManager      = emailManager;
     _logger            = loggerFactory.CreateLogger <AccountController>();
     _appSettings       = appSettings.Value;
     _captchaService    = captchaService;
 }
Exemple #31
0
 public AccountController(
     ILogger logger,
     IMapper mapper,
     IDbContextManager contextManager,
     IAccountService accountService,
     IAuthenticationProvider authenticationProvider,
     IUserService userService,
     IUserMailService userMailService,
     ICaptchaService captchaService,
     IRestApiService restApiService)
     : base(logger, mapper, contextManager)
 {
     this.accountService         = accountService;
     this.authenticationProvider = authenticationProvider;
     this.userService            = userService;
     this.userMailService        = userMailService;
     this.captchaService         = captchaService;
     this.restApiService         = restApiService;
 }
 public AccountControllerTests()
 {
     accountService         = Mock.Create <IAccountService>();
     authenticationProvider = Mock.Create <IAuthenticationProvider>();
     captchaService         = Mock.Create <ICaptchaService>();
     restApiService         = Mock.Create <IRestApiService>();
     userMailService        = Mock.Create <IUserMailService>();
     userService            = Mock.Create <IUserService>();
     accountController      = new AccountController(
         Logger,
         Mapper,
         ContextManager,
         accountService,
         authenticationProvider,
         userService,
         userMailService,
         captchaService,
         restApiService);
     InitContext();
 }
 public AccountController(IUserService userService, ICaptchaService captchaService)
 {
     this.userService = userService;
     this.captchaService = captchaService;
 }
		/// <summary>
		/// Инициализация обертки VkApi с использованием сервиса распознавания капчи.
		/// </summary>
		/// <param name="captchaService">The captcha service.</param>
		public VkApiWithCaptchaService(ICaptchaService captchaService)
		{
			_captchaService = captchaService;
		}
 public CaptchaController(ICaptchaService capthcaService)
 {
     this.capthcaService = capthcaService;
 }
Exemple #36
0
 public AdvertService(IAuthService a = null, ICaptchaService c = null)
 {
     auth = a;
     captcha = c;
 }
Exemple #37
0
		public void SetCaptchaRecognizer(ICaptchaService captcha)
		{
			this.captcha = captcha;
		}
Exemple #38
0
 public AccountController(IUserService userService, ICaptchaService captchaService)
 {
     _userService = userService;
     _captchaService = captchaService;
 }