Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Minor changes Filters
support34188ee74971
diff --git a/src/Web/Grand.Web.Common/Filters/AffiliateAttribute.cs b/src/Web/Grand.Web.Common/Filters/AffiliateAttribute.csindex 0c5c76e26..5a4fda32a 100644--- a/src/Web/Grand.Web.Common/Filters/AffiliateAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/AffiliateAttribute.cs@@ -85,8 +85,8 @@ namespace Grand.Web.Common.Filterspublic async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next){await next();-- if (context?.HttpContext.Request == null)++ if (!DataSettingsManager.DatabaseIsInstalled())return;//check request query parameters@@ -94,9 +94,7 @@ namespace Grand.Web.Common.Filtersif (!request.Query.Any())return;- if (!DataSettingsManager.DatabaseIsInstalled())- return;-+//try to find by IDvar affiliateIds = request.Query[IdQueryParameterName];if (affiliateIds.Any())diff --git a/src/Web/Grand.Web.Common/Filters/ArgumentNameFilterAttribute.cs b/src/Web/Grand.Web.Common/Filters/ArgumentNameFilterAttribute.csindex 7442c9196..a4477397d 100644--- a/src/Web/Grand.Web.Common/Filters/ArgumentNameFilterAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/ArgumentNameFilterAttribute.cs@@ -9,11 +9,7 @@ namespace Grand.Web.Common.Filterspublic override void OnActionExecuting(ActionExecutingContext context){- if (context?.HttpContext.Request == null)- return;-context.ActionArguments[Argument] = context.HttpContext.Request.Form.Keys.Any(key => key.Equals(KeyName));-}}}diff --git a/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs b/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.csindex 673cbec7f..b66c15ada 100644--- a/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs@@ -93,7 +93,7 @@ namespace Grand.Web.Common.Filters//whether current customer is vendorif (await _groupService.IsVendor(_workContext.CurrentCustomer) || _workContext.CurrentVendor is not null)- filterContext.Result = new RedirectToRouteResult("AdminLogin", new RouteValueDictionary());;+ filterContext.Result = new RedirectToRouteResult("AdminLogin", new RouteValueDictionary());//get allowed IP addressesvar ipAddresses = _securitySettings.AdminAreaAllowedIpAddresses;diff --git a/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs b/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.csindex c890a69f6..653a1e4d5 100644--- a/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs@@ -65,8 +65,6 @@ namespace Grand.Web.Common.Filterspublic async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next){await next();- if (context?.HttpContext?.Request == null)- return;if (!DataSettingsManager.DatabaseIsInstalled())return;diff --git a/src/Web/Grand.Web.Common/Filters/LanguageAttribute.cs b/src/Web/Grand.Web.Common/Filters/LanguageAttribute.csindex 87c8363a8..78e793033 100644--- a/src/Web/Grand.Web.Common/Filters/LanguageAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/LanguageAttribute.cs@@ -60,12 +60,6 @@ namespace Grand.Web.Common.Filters/// <param name="next">Action execution delegate</param>public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next){- if (context?.HttpContext?.Request == null)- {- await next();- return;- }-if (!DataSettingsManager.DatabaseIsInstalled()){await next();@@ -94,7 +88,7 @@ namespace Grand.Web.Common.Filters}//check whether current page URL is already localized URL- var pageUrl = context.HttpContext?.Request?.GetEncodedPathAndQuery();+ var pageUrl = context.HttpContext.Request?.GetEncodedPathAndQuery();if (await IsLocalized(pageUrl, context.HttpContext.Request.PathBase)){await next();@@ -107,7 +101,7 @@ namespace Grand.Web.Common.Filtersprivate async Task<bool> IsLocalized(string url, PathString pathBase){- var _ = new PathString(url).StartsWithSegments(pathBase, out PathString result);+ _ = new PathString(url).StartsWithSegments(pathBase, out PathString result);url = WebUtility.UrlDecode(result);var firstSegment = url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() ?? string.Empty;diff --git a/src/Web/Grand.Web.Common/Filters/PasswordExpiredAttribute.cs b/src/Web/Grand.Web.Common/Filters/PasswordExpiredAttribute.csindex 44a490245..148291d0c 100644--- a/src/Web/Grand.Web.Common/Filters/PasswordExpiredAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/PasswordExpiredAttribute.cs@@ -53,9 +53,7 @@ namespace Grand.Web.Common.Filters/// <param name="context">A context for action filters</param>public async Task OnAuthorizationAsync(AuthorizationFilterContext context){- if (context?.HttpContext.Request == null)- return;-+if (!DataSettingsManager.DatabaseIsInstalled())return;