Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
        public virtual async Task <IActionResult> SetStore(
            [FromServices] IStoreService storeService,
            [FromServices] IStoreHelper _storeHelper,
            [FromServices] CommonSettings commonSettings,
            string store, string returnUrl = "")
        {
            var currentstoreid = _workContext.CurrentStore.Id;

            if (currentstoreid != store)
            {
                if (commonSettings.AllowToSelectStore)
                {
                    var selectedstore = await storeService.GetStoreById(store);

                    if (selectedstore != null)
                    {
                        await _storeHelper.SetStoreCookie(store);
                    }
                }
            }
            var prevStore = await storeService.GetStoreById(currentstoreid);

            var currStore = await storeService.GetStoreById(store);

            if (prevStore != null && currStore != null)
            {
                if (prevStore.Url != currStore.Url)
                {
                    return(Redirect(currStore.SslEnabled ? currStore.SecureUrl : currStore.Url));
                }
            }

            //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));
        }
Ejemplo n.º 3
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;
 }