public PasswordRecoverySendCommandHandler(
     IUserFieldService userFieldService,
     IMessageProviderService messageProviderService)
 {
     _userFieldService       = userFieldService;
     _messageProviderService = messageProviderService;
 }
Exemplo n.º 2
0
        public virtual async Task <IActionResult> CookieAccept(bool accept,
                                                               [FromServices] StoreInformationSettings storeInformationSettings,
                                                               [FromServices] IUserFieldService userFieldService,
                                                               [FromServices] ICookiePreference cookiePreference)
        {
            if (!storeInformationSettings.DisplayCookieInformation)
            {
                //disabled
                return(Json(new { stored = false }));
            }

            //save consentcookies
            await userFieldService.SaveField(_workContext.CurrentCustomer, SystemCustomerFieldNames.ConsentCookies, "", _workContext.CurrentStore.Id);

            var dictionary     = new Dictionary <string, bool>();
            var consentCookies = cookiePreference.GetConsentCookies();

            foreach (var item in consentCookies.Where(x => x.AllowToDisable))
            {
                dictionary.Add(item.SystemName, accept);
            }
            if (dictionary.Any())
            {
                await userFieldService.SaveField <Dictionary <string, bool> >(_workContext.CurrentCustomer, SystemCustomerFieldNames.ConsentCookies, dictionary, _workContext.CurrentStore.Id);
            }

            //save setting - CookieAccepted
            await userFieldService.SaveField(_workContext.CurrentCustomer, SystemCustomerFieldNames.CookieAccepted, true, _workContext.CurrentStore.Id);

            return(Json(new { stored = true }));
        }
 public GetPrivacyPreferenceModelHandler(
     IUserFieldService userFieldService,
     ICookiePreference cookiePreference)
 {
     _userFieldService = userFieldService;
     _cookiePreference = cookiePreference;
 }
Exemplo n.º 4
0
 public WorkContext(
     IHttpContextAccessor httpContextAccessor,
     IGrandAuthenticationService authenticationService,
     IApiAuthenticationService apiauthenticationService,
     ICurrencyService currencyService,
     ICustomerService customerService,
     IGroupService groupService,
     IUserFieldService userFieldService,
     ILanguageService languageService,
     IStoreHelper storeHelper,
     IAclService aclService,
     IVendorService vendorService,
     IDetectionService detectionService,
     LanguageSettings languageSettings,
     TaxSettings taxSettings,
     AppConfig config)
 {
     _httpContextAccessor      = httpContextAccessor;
     _authenticationService    = authenticationService;
     _apiauthenticationService = apiauthenticationService;
     _currencyService          = currencyService;
     _customerService          = customerService;
     _groupService             = groupService;
     _userFieldService         = userFieldService;
     _languageService          = languageService;
     _storeHelper      = storeHelper;
     _aclService       = aclService;
     _vendorService    = vendorService;
     _detectionService = detectionService;
     _languageSettings = languageSettings;
     _taxSettings      = taxSettings;
     _config           = config;
 }
Exemplo n.º 5
0
        public virtual async Task <IActionResult> SetCurrency(
            [FromServices] ICurrencyService currencyService,
            [FromServices] IUserFieldService userFieldService,
            string customerCurrency, string returnUrl = "")
        {
            var currency = await currencyService.GetCurrencyById(customerCurrency);

            if (currency != null)
            {
                await _workContext.SetWorkingCurrency(currency);
            }

            //clear coupon code
            await userFieldService.SaveField(_workContext.CurrentCustomer, SystemCustomerFieldNames.DiscountCoupons, "");

            //clear gift card
            await userFieldService.SaveField(_workContext.CurrentCustomer, SystemCustomerFieldNames.GiftVoucherCoupons, "");

            //home page
            if (String.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Url.RouteUrl("HomePage");
            }

            //prevent open redirection attack
            if (!Url.IsLocalUrl(returnUrl))
            {
                returnUrl = Url.RouteUrl("HomePage");
            }

            return(Redirect(returnUrl));
        }
Exemplo n.º 6
0
 public CatalogController(
     IVendorService vendorService,
     ICategoryService categoryService,
     IBrandService brandService,
     ICollectionService collectionService,
     IWorkContext workContext,
     IGroupService groupService,
     ITranslationService translationService,
     IUserFieldService userFieldService,
     IAclService aclService,
     IPermissionService permissionService,
     ICustomerActivityService customerActivityService,
     ICustomerActionEventService customerActionEventService,
     IMediator mediator,
     VendorSettings vendorSettings)
 {
     _vendorService              = vendorService;
     _categoryService            = categoryService;
     _brandService               = brandService;
     _collectionService          = collectionService;
     _workContext                = workContext;
     _groupService               = groupService;
     _translationService         = translationService;
     _userFieldService           = userFieldService;
     _aclService                 = aclService;
     _permissionService          = permissionService;
     _customerActivityService    = customerActivityService;
     _customerActionEventService = customerActionEventService;
     _mediator       = mediator;
     _vendorSettings = vendorSettings;
 }
 public ShoppingCartController(
     IWorkContext workContext,
     IShoppingCartService shoppingCartService,
     ITranslationService translationService,
     IDiscountService discountService,
     ICustomerService customerService,
     IGroupService groupService,
     ICheckoutAttributeService checkoutAttributeService,
     IPermissionService permissionService,
     IUserFieldService userFieldService,
     IMediator mediator,
     IShoppingCartValidator shoppingCartValidator,
     ShoppingCartSettings shoppingCartSettings,
     OrderSettings orderSettings)
 {
     _workContext              = workContext;
     _shoppingCartService      = shoppingCartService;
     _translationService       = translationService;
     _discountService          = discountService;
     _customerService          = customerService;
     _groupService             = groupService;
     _checkoutAttributeService = checkoutAttributeService;
     _permissionService        = permissionService;
     _userFieldService         = userFieldService;
     _mediator = mediator;
     _shoppingCartValidator = shoppingCartValidator;
     _shoppingCartSettings  = shoppingCartSettings;
     _orderSettings         = orderSettings;
 }
Exemplo n.º 8
0
 public CourseController(
     IPermissionService permissionService,
     IAclService aclService,
     IWorkContext workContext,
     IGroupService groupService,
     ICustomerActivityService customerActivityService,
     IUserFieldService userFieldService,
     ITranslationService translationService,
     ICustomerActionEventService customerActionEventService,
     ICourseService courseService,
     ICourseLessonService courseLessonService,
     IDownloadService downloadService,
     IMediator mediator,
     CourseSettings courseSettings)
 {
     _permissionService          = permissionService;
     _aclService                 = aclService;
     _workContext                = workContext;
     _groupService               = groupService;
     _customerActivityService    = customerActivityService;
     _userFieldService           = userFieldService;
     _translationService         = translationService;
     _customerActionEventService = customerActionEventService;
     _courseService              = courseService;
     _courseLessonService        = courseLessonService;
     _downloadService            = downloadService;
     _mediator       = mediator;
     _courseSettings = courseSettings;
 }
 public CustomerRegisteredCommandHandler(
     IUserFieldService userFieldService,
     IVatService checkVatService,
     IMessageProviderService messageProviderService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IAddressAttributeService addressAttributeService,
     ICountryService countryService,
     ICustomerService customerService,
     ICustomerActionEventService customerActionEventService,
     TaxSettings taxSettings,
     CustomerSettings customerSettings,
     AddressSettings addressSettings,
     LanguageSettings languageSettings)
 {
     _userFieldService              = userFieldService;
     _checkVatService               = checkVatService;
     _messageProviderService        = messageProviderService;
     _newsLetterSubscriptionService = newsLetterSubscriptionService;
     _addressAttributeService       = addressAttributeService;
     _countryService             = countryService;
     _customerService            = customerService;
     _customerActionEventService = customerActionEventService;
     _taxSettings      = taxSettings;
     _customerSettings = customerSettings;
     _addressSettings  = addressSettings;
     _languageSettings = languageSettings;
 }
 public JwtBearerCustomerAuthenticationService(ICustomerService customerService, IPermissionService permissionService
                                               , IUserFieldService userFieldService, IGroupService groupService, IRefreshTokenService refreshTokenService)
 {
     _customerService     = customerService;
     _permissionService   = permissionService;
     _userFieldService    = userFieldService;
     _groupService        = groupService;
     _refreshTokenService = refreshTokenService;
 }
Exemplo n.º 11
0
 public CustomerService(
     IRepository <Customer> customerRepository,
     IUserFieldService userFieldService,
     IMediator mediator)
 {
     _customerRepository = customerRepository;
     _userFieldService   = userFieldService;
     _mediator           = mediator;
 }
Exemplo n.º 12
0
 public TwoFactorAuthenticationService(
     IWorkContext workContext,
     IUserFieldService userFieldService,
     IServiceProvider serviceProvider)
 {
     _workContext             = workContext;
     _userFieldService        = userFieldService;
     _serviceProvider         = serviceProvider;
     _twoFactorAuthentication = new TwoFactorAuthenticator();
 }
 public SaveCheckoutAttributesCommandHandler(
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDownloadService downloadService,
     IUserFieldService userFieldService)
 {
     _checkoutAttributeService = checkoutAttributeService;
     _checkoutAttributeParser  = checkoutAttributeParser;
     _downloadService          = downloadService;
     _userFieldService         = userFieldService;
 }
Exemplo n.º 14
0
 public SubAccountAddCommandHandler(
     ICustomerService customerService,
     ICustomerManagerService customerManagerService,
     IUserFieldService userFieldService,
     CustomerSettings customerSettings)
 {
     _customerService        = customerService;
     _customerManagerService = customerManagerService;
     _userFieldService       = userFieldService;
     _customerSettings       = customerSettings;
 }
Exemplo n.º 15
0
 public UserFieldController(IUserFieldService userFieldService, ICacheBase cacheBase, ITranslationService translationService,
                            IWorkContext workContext, IGroupService groupService, IPermissionService permissionService, IServiceProvider serviceProvider)
 {
     _userFieldService   = userFieldService;
     _cacheBase          = cacheBase;
     _translationService = translationService;
     _workContext        = workContext;
     _groupService       = groupService;
     _permissionService  = permissionService;
     _serviceProvider    = serviceProvider;
 }
Exemplo n.º 16
0
 public FacebookAuthenticationEventConsumer(
     IUserFieldService userFieldService,
     IMessageProviderService messageProviderService,
     IWorkContext workContext,
     CustomerSettings customerSettings)
 {
     _userFieldService       = userFieldService;
     _messageProviderService = messageProviderService;
     _workContext            = workContext;
     _customerSettings       = customerSettings;
 }
Exemplo n.º 17
0
 public ThemeContext(IWorkContext workContext,
                     IUserFieldService userFieldService,
                     StoreInformationSettings storeInformationSettings,
                     VendorSettings vendorSettings,
                     IThemeProvider themeProvider)
 {
     _workContext              = workContext;
     _userFieldService         = userFieldService;
     _storeInformationSettings = storeInformationSettings;
     _vendorSettings           = vendorSettings;
     _themeProvider            = themeProvider;
 }
Exemplo n.º 18
0
 public UpdateCustomerCommandHandler(
     ICustomerService customerService,
     IGroupService groupService,
     ICustomerActivityService customerActivityService,
     ITranslationService translationService,
     IUserFieldService userFieldsService)
 {
     _customerService         = customerService;
     _groupService            = groupService;
     _customerActivityService = customerActivityService;
     _translationService      = translationService;
     _userFieldsService       = userFieldsService;
 }
Exemplo n.º 19
0
 public CustomerActivityFilter(
     ICustomerService customerService,
     IWorkContext workContext,
     IUserFieldService userFieldService,
     ICustomerActivityService customerActivityService,
     ICustomerActionEventService customerActionEventService,
     CustomerSettings customerSettings)
 {
     _customerService            = customerService;
     _workContext                = workContext;
     _userFieldService           = userFieldService;
     _customerActivityService    = customerActivityService;
     _customerActionEventService = customerActionEventService;
     _customerSettings           = customerSettings;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="customerSettings">Customer settings</param>
 /// <param name="customerService">Customer service</param>
 /// <param name="groupService">Group service</param>
 /// <param name="userFieldService">Generic sttribute service</param>
 /// <param name="httpContextAccessor">HTTP context accessor</param>
 /// <param name="AppConfig">AppConfig</param>
 public CookieAuthenticationService(
     CustomerSettings customerSettings,
     ICustomerService customerService,
     IGroupService groupService,
     IUserFieldService userFieldService,
     IHttpContextAccessor httpContextAccessor,
     AppConfig appConfig)
 {
     _customerSettings    = customerSettings;
     _customerService     = customerService;
     _groupService        = groupService;
     _userFieldService    = userFieldService;
     _httpContextAccessor = httpContextAccessor;
     _appConfig           = appConfig;
 }
Exemplo n.º 21
0
 public GetShippingMethodHandler(IShippingService shippingService,
                                 IUserFieldService userFieldService,
                                 IOrderCalculationService orderTotalCalculationService,
                                 ITaxService taxService,
                                 ICurrencyService currencyService,
                                 IPriceFormatter priceFormatter,
                                 ShippingSettings shippingSettings)
 {
     _shippingService              = shippingService;
     _userFieldService             = userFieldService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _taxService       = taxService;
     _currencyService  = currencyService;
     _priceFormatter   = priceFormatter;
     _shippingSettings = shippingSettings;
 }
Exemplo n.º 22
0
 public TokenWebController(
     ICustomerService customerService,
     ICustomerManagerService customerManagerService,
     IMediator mediator,
     IStoreHelper storeHelper,
     IRefreshTokenService refreshTokenService,
     IUserFieldService userFieldService,
     IAntiforgery antiforgery)
 {
     _customerService        = customerService;
     _customerManagerService = customerManagerService;
     _mediator            = mediator;
     _storeHelper         = storeHelper;
     _refreshTokenService = refreshTokenService;
     _userFieldService    = userFieldService;
     _antiforgery         = antiforgery;
 }
 public ShippingPointRateProvider(
     IShippingPointService shippingPointService,
     ITranslationService translationService,
     IWorkContext workContext,
     IUserFieldService userFieldService,
     ICountryService countryService,
     ICurrencyService currencyService,
     ShippingPointRateSettings shippingPointRateSettings
     )
 {
     _shippingPointService      = shippingPointService;
     _translationService        = translationService;
     _workContext               = workContext;
     _userFieldService          = userFieldService;
     _countryService            = countryService;
     _currencyService           = currencyService;
     _shippingPointRateSettings = shippingPointRateSettings;
 }
Exemplo n.º 24
0
 public ShippingPointController(
     IWorkContext workContext,
     IUserFieldService userFieldService,
     ITranslationService translationService,
     IShippingPointService ShippingPointService,
     ICountryService countryService,
     IStoreService storeService,
     IPriceFormatter priceFormatter
     )
 {
     _workContext          = workContext;
     _userFieldService     = userFieldService;
     _translationService   = translationService;
     _shippingPointService = ShippingPointService;
     _countryService       = countryService;
     _storeService         = storeService;
     _priceFormatter       = priceFormatter;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="customerService">Customer service</param>
 /// <param name="groupService">Group service</param>
 /// <param name="encryptionService">Encryption service</param>
 /// <param name="translationService">Translation service</param>
 /// <param name="mediator">Mediator</param>
 /// <param name="userFieldService">UserFields service</param>
 /// <param name="customerHistoryPasswordService">History password</param>
 /// <param name="customerSettings">Customer settings</param>
 public CustomerManagerService(
     ICustomerService customerService,
     IGroupService groupService,
     IEncryptionService encryptionService,
     ITranslationService translationService,
     IMediator mediator,
     IUserFieldService userFieldService,
     ICustomerHistoryPasswordService customerHistoryPasswordService,
     CustomerSettings customerSettings)
 {
     _customerService                = customerService;
     _groupService                   = groupService;
     _encryptionService              = encryptionService;
     _translationService             = translationService;
     _mediator                       = mediator;
     _userFieldService               = userFieldService;
     _customerHistoryPasswordService = customerHistoryPasswordService;
     _customerSettings               = customerSettings;
 }
 public UpdateCustomerInfoCommandHandler(
     ICustomerManagerService customerManagerService,
     IGrandAuthenticationService authenticationService,
     IUserFieldService userFieldService,
     IVatService checkVatService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     ICustomerService customerService,
     IMediator mediator,
     CustomerSettings customerSettings,
     TaxSettings taxSettings)
 {
     _customerManagerService        = customerManagerService;
     _authenticationService         = authenticationService;
     _userFieldService              = userFieldService;
     _checkVatService               = checkVatService;
     _newsLetterSubscriptionService = newsLetterSubscriptionService;
     _customerService               = customerService;
     _mediator         = mediator;
     _customerSettings = customerSettings;
     _taxSettings      = taxSettings;
 }
Exemplo n.º 27
0
 public ShoppingCartService(
     IWorkContext workContext,
     IProductService productService,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeParser checkoutAttributeParser,
     ICustomerService customerService,
     IMediator mediator,
     IUserFieldService userFieldService,
     IProductReservationService productReservationService,
     IShoppingCartValidator shoppingCartValidator,
     ShoppingCartSettings shoppingCartSettings)
 {
     _workContext             = workContext;
     _productService          = productService;
     _productAttributeParser  = productAttributeParser;
     _checkoutAttributeParser = checkoutAttributeParser;
     _customerService         = customerService;
     _mediator                  = mediator;
     _userFieldService          = userFieldService;
     _productReservationService = productReservationService;
     _shoppingCartValidator     = shoppingCartValidator;
     _shoppingCartSettings      = shoppingCartSettings;
 }
 public PayPalStandardPaymentProvider(
     ICheckoutAttributeParser checkoutAttributeParser,
     IUserFieldService userFieldService,
     IHttpContextAccessor httpContextAccessor,
     ITranslationService translationService,
     ITaxService taxService,
     IProductService productService,
     IServiceProvider serviceProvider,
     IWorkContext workContext,
     IOrderService orderService,
     PayPalStandardPaymentSettings paypalStandardPaymentSettings)
 {
     _checkoutAttributeParser = checkoutAttributeParser;
     _userFieldService        = userFieldService;
     _httpContextAccessor     = httpContextAccessor;
     _translationService      = translationService;
     _taxService      = taxService;
     _productService  = productService;
     _serviceProvider = serviceProvider;
     _workContext     = workContext;
     _orderService    = orderService;
     _paypalStandardPaymentSettings = paypalStandardPaymentSettings;
 }
Exemplo n.º 29
0
        public virtual async Task <IActionResult> PrivacyPreference(IFormCollection form,
                                                                    [FromServices] StoreInformationSettings storeInformationSettings,
                                                                    [FromServices] IUserFieldService userFieldService,
                                                                    [FromServices] ICookiePreference _cookiePreference)
        {
            if (!storeInformationSettings.DisplayPrivacyPreference)
            {
                return(Json(new { success = false }));
            }

            var consent = "ConsentCookies";
            await userFieldService.SaveField(_workContext.CurrentCustomer, SystemCustomerFieldNames.ConsentCookies, "", _workContext.CurrentStore.Id);

            var selectedConsentCookies = new List <string>();

            foreach (var item in form)
            {
                if (item.Key.StartsWith(consent))
                {
                    selectedConsentCookies.Add(item.Value);
                }
            }
            var dictionary     = new Dictionary <string, bool>();
            var consentCookies = _cookiePreference.GetConsentCookies();

            foreach (var item in consentCookies)
            {
                if (item.AllowToDisable)
                {
                    dictionary.Add(item.SystemName, selectedConsentCookies.Contains(item.SystemName));
                }
            }

            await userFieldService.SaveField <Dictionary <string, bool> >(_workContext.CurrentCustomer, SystemCustomerFieldNames.ConsentCookies, dictionary, _workContext.CurrentStore.Id);

            return(Json(new { success = true }));
        }
Exemplo n.º 30
0
        /// <summary>
        /// Get an user field of an entity
        /// </summary>
        /// <typeparam name="TPropType">Property type</typeparam>
        /// <param name="entity">Entity</param>
        /// <param name="userFieldService">UserFieldService</param>
        /// <param name="key">Key</param>
        /// <param name="storeId">Load a value specific for a certain store; pass 0 to load a value shared for all stores</param>
        /// <returns>Attribute</returns>
        public static async Task <TPropType> GetUserField <TPropType>(this BaseEntity entity, IUserFieldService userFieldService, string key, string storeId = "")
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            return(await userFieldService.GetFieldsForEntity <TPropType>(entity, key, storeId));
        }