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
Add new type filter for prevent to run an action (e.g. changing the currency, language, etc ...) for system accounts.
KrzysztofPajakec65c6a3d154
diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.csindex 626bdb07b..b4542d3f3 100644--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs@@ -842,12 +842,7 @@ namespace Grand.Business.Checkout.Services.Orderswarnings.Add("Wishlist is disabled");return warnings;}- if (customer.IsSystemAccount())- {- warnings.Add("System account can't add to cart");- return warnings;- }-+if (quantity <= 0){warnings.Add(_translationService.GetResource("ShoppingCart.QuantityShouldPositive"));diff --git a/src/Business/Grand.Business.Customers/Services/CustomerManagerService.cs b/src/Business/Grand.Business.Customers/Services/CustomerManagerService.csindex b3e2f204a..000a2735b 100644--- a/src/Business/Grand.Business.Customers/Services/CustomerManagerService.cs+++ b/src/Business/Grand.Business.Customers/Services/CustomerManagerService.cs@@ -153,11 +153,7 @@ namespace Grand.Business.Customers.Servicesthrow new ArgumentException("Can't load current customer");var result = new RegistrationResult();- if (request.Customer.IsSystemAccount())- {- result.AddError("System account can't be registered");- return result;- }+if (await _groupService.IsRegistered(request.Customer)){result.AddError("Current customer is already registered");diff --git a/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.cs b/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.csnew file mode 100644index 000000000..41546d27e--- /dev/null+++ b/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.cs@@ -0,0 +1,88 @@+using Grand.Domain.Customers;+using Grand.Domain.Data;+using Grand.Infrastructure;+using Microsoft.AspNetCore.Mvc;+using Microsoft.AspNetCore.Mvc.Filters;+using Microsoft.AspNetCore.Routing;++namespace Grand.Web.Common.Filters+{+ /// <summary>+ /// Represents a filter attribute that deny system account to some resources+ /// </summary>+ public class DenySystemAccountAttribute : TypeFilterAttribute+ {+ private readonly bool _ignoreFilter;++ /// <summary>+ /// Create instance of the filter attribute+ /// </summary>+ /// <param name="ignore">Whether to ignore the execution of filter actions</param>+ public DenySystemAccountAttribute(bool ignore = false) : base(typeof(DenySystemAccountFilter))+ {+ _ignoreFilter = ignore;+ Arguments = new object[] { ignore };+ }++ public bool IgnoreFilter => _ignoreFilter;++ #region Filter++ /// <summary>+ /// Represents a filter that deny access for system accounts to resources+ /// </summary>+ private class DenySystemAccountFilter : IAsyncAuthorizationFilter+ {+ #region Fields++ private readonly bool _ignoreFilter;+ private readonly IWorkContext _workContext;++ #endregion++ #region Ctor++ public DenySystemAccountFilter(bool ignoreFilter, IWorkContext workContext)+ {+ _ignoreFilter = ignoreFilter;+ _workContext = workContext;+ }++ #endregion++ #region Methods++ /// <summary>+ /// Called early in the filter pipeline to confirm request is authorized+ /// </summary>+ /// <param name="filterContext">Authorization filter context</param>+ public Task OnAuthorizationAsync(AuthorizationFilterContext context)+ {+ //ignore filter (the action available even when navigation is not allowed)+ if (context == null)+ throw new ArgumentNullException(nameof(context));++ var actionFilter = context.ActionDescriptor.FilterDescriptors+ .Where(f => f.Scope == FilterScope.Action)+ .Select(f => f.Filter).OfType<DenySystemAccountAttribute>().FirstOrDefault();++ //ignore filter+ if (actionFilter?.IgnoreFilter ?? _ignoreFilter)+ return Task.CompletedTask;++ if (!DataSettingsManager.DatabaseIsInstalled())+ return Task.CompletedTask;++ if (_workContext.CurrentCustomer.IsSystemAccount())+ context.Result = new RedirectToRouteResult("HomePage", new RouteValueDictionary());++ return Task.CompletedTask;++ }++ #endregion+ }++ #endregion+ }+}\ No newline at end of filediff --git a/src/Web/Grand.Web/Controllers/AccountController.cs b/src/Web/Grand.Web/Controllers/AccountController.csindex d09e62fc5..e76a10ec1 100644--- a/src/Web/Grand.Web/Controllers/AccountController.cs+++ b/src/Web/Grand.Web/Controllers/AccountController.cs@@ -27,6 +27,7 @@ using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class AccountController : BasePublicController{#region Fieldsdiff --git a/src/Web/Grand.Web/Controllers/ActionCartController.cs b/src/Web/Grand.Web/Controllers/ActionCartController.csindex bcb72a4fe..c1a5d8878 100644--- a/src/Web/Grand.Web/Controllers/ActionCartController.cs+++ b/src/Web/Grand.Web/Controllers/ActionCartController.cs@@ -10,6 +10,7 @@ using Grand.Domain.Catalog;using Grand.Domain.Common;using Grand.Domain.Orders;using Grand.Infrastructure;+using Grand.Web.Common.Filters;using Grand.Web.Extensions;using Grand.Web.Features.Models.Products;using Grand.Web.Features.Models.ShoppingCart;@@ -21,6 +22,7 @@ using System.Globalization;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class ActionCartController : BasePublicController{#region Fields@@ -362,6 +364,7 @@ namespace Grand.Web.Controllersreturn quantity;}+[HttpPost]public virtual async Task<IActionResult> AddProductDetails(string productId, int shoppingCartTypeId, IFormCollection form){@@ -712,8 +715,6 @@ namespace Grand.Web.Controllers});}--public virtual async Task<IActionResult> GetItemCart(string shoppingcartId){var cart = _workContext.CurrentCustomer.ShoppingCartItems.FirstOrDefault(sci => sci.Id == shoppingcartId);@@ -772,7 +773,7 @@ namespace Grand.Web.Controllersmodel = model,});}-+[HttpPost]public virtual async Task<IActionResult> UpdateItemCart(string shoppingCartItemId, IFormCollection form){diff --git a/src/Web/Grand.Web/Controllers/BlogController.cs b/src/Web/Grand.Web/Controllers/BlogController.csindex 13a867e4b..0df508772 100644--- a/src/Web/Grand.Web/Controllers/BlogController.cs+++ b/src/Web/Grand.Web/Controllers/BlogController.cs@@ -124,6 +124,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> BlogCommentAdd(string blogPostId, BlogPostModel model, bool captchaValid){if (!_blogSettings.Enabled)diff --git a/src/Web/Grand.Web/Controllers/CatalogController.cs b/src/Web/Grand.Web/Controllers/CatalogController.csindex 18be60ec1..ddeeb74d1 100644--- a/src/Web/Grand.Web/Controllers/CatalogController.cs+++ b/src/Web/Grand.Web/Controllers/CatalogController.cs@@ -350,6 +350,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> VendorReviews(VendorReviewsModel model, bool captchaValid,[FromServices] CaptchaSettings captchaSettings)@@ -426,6 +427,7 @@ namespace Grand.Web.Controllersreturn Json(returnmodel);}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> SetVendorReviewHelpfulness(string VendorReviewId, string vendorId, bool washelpful, [FromServices] ICustomerService customerService){diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.csindex 3a5395261..4653b6e85 100644--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs@@ -19,6 +19,7 @@ using Grand.Domain.Payments;using Grand.Domain.Shipping;using Grand.Infrastructure;using Grand.Infrastructure.Extensions;+using Grand.Web.Common.Filters;using Grand.Web.Extensions;using Grand.Web.Features.Models.Checkout;using Grand.Web.Features.Models.Common;@@ -30,6 +31,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class CheckoutController : BasePublicController{#region Fieldsdiff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.csindex 5ee99b288..cda7cd6da 100644--- a/src/Web/Grand.Web/Controllers/CommonController.cs+++ b/src/Web/Grand.Web/Controllers/CommonController.cs@@ -134,6 +134,7 @@ namespace Grand.Web.Controllers}[PublicStore(true)]+ [DenySystemAccount]public virtual async Task<IActionResult> SetLanguage([FromServices] AppConfig config,string langcode, string returnUrl = default)@@ -201,6 +202,7 @@ namespace Grand.Web.Controllersreturn Redirect(url);}+ [DenySystemAccount][PublicStore(true)]public virtual async Task<IActionResult> SetCurrency([FromServices] ICurrencyService currencyService,@@ -231,6 +233,7 @@ namespace Grand.Web.Controllersreturn Redirect(returnUrl);}+ [DenySystemAccount]//available even when navigation is not allowed[PublicStore(true)]public virtual async Task<IActionResult> SetStore(@@ -271,6 +274,7 @@ namespace Grand.Web.Controllersreturn Redirect(returnUrl);}+ [DenySystemAccount]//available even when navigation is not allowed[PublicStore(true)]public virtual async Task<IActionResult> SetTaxType(int customerTaxType, string returnUrl = "")@@ -292,6 +296,7 @@ namespace Grand.Web.Controllersreturn Redirect(returnUrl);}+ [DenySystemAccount]public virtual async Task<IActionResult> SetStoreTheme([FromServices] IThemeContext themeContext, string themeName, string returnUrl = ""){@@ -338,6 +343,7 @@ namespace Grand.Web.Controllers[AutoValidateAntiforgeryToken][ValidateCaptcha][ClosedStore(true)]+ [DenySystemAccount]public virtual async Task<IActionResult> ContactUsSend([FromServices] StoreInformationSettings storeInformationSettings,[FromServices] IPageService pageService,@@ -411,6 +417,7 @@ namespace Grand.Web.Controllers[HttpPost][ClosedStore(true)][PublicStore(true)]+ [DenySystemAccount]public virtual async Task<IActionResult> CookieAccept(bool accept,[FromServices] StoreInformationSettings storeInformationSettings,[FromServices] IUserFieldService userFieldService,@@ -461,6 +468,7 @@ namespace Grand.Web.Controllers[HttpPost][ClosedStore(true)][PublicStore(true)]+ [DenySystemAccount]public virtual async Task<IActionResult> PrivacyPreference(IFormCollection form,[FromServices] StoreInformationSettings storeInformationSettings,[FromServices] IUserFieldService userFieldService,@@ -511,6 +519,7 @@ namespace Grand.Web.Controllerspublic virtual IActionResult StoreClosed() => View();[HttpPost]+ [DenySystemAccount]public virtual async Task<IActionResult> ContactAttributeChange(IFormCollection form){var result = await _mediator.Send(new ContactAttributeChangeCommand() {@@ -526,6 +535,7 @@ namespace Grand.Web.Controllers}[HttpPost]+ [DenySystemAccount]public virtual async Task<IActionResult> UploadFileContactAttribute(string attributeId,[FromServices] IDownloadService downloadService,[FromServices] IContactAttributeService contactAttributeService)@@ -626,6 +636,7 @@ namespace Grand.Web.Controllers[HttpPost, ActionName("PopupInteractiveForm")]+ [DenySystemAccount]public virtual async Task<IActionResult> PopupInteractiveForm(IFormCollection formCollection){var result = await _mediator.Send(new PopupInteractiveCommand() { Form = formCollection });@@ -639,6 +650,7 @@ namespace Grand.Web.Controllers[HttpPost][ClosedStore(true)][PublicStore(true)]+ [DenySystemAccount]public virtual async Task<IActionResult> SaveCurrentPosition(LocationModel model,[FromServices] CustomerSettings customerSettings)diff --git a/src/Web/Grand.Web/Controllers/ComponentController.cs b/src/Web/Grand.Web/Controllers/ComponentController.csindex c6c3b4326..f3db084be 100644--- a/src/Web/Grand.Web/Controllers/ComponentController.cs+++ b/src/Web/Grand.Web/Controllers/ComponentController.cs@@ -1,4 +1,5 @@using Grand.Web.Common.Components;+using Grand.Web.Common.Filters;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.ViewComponents;using System.Reflection;@@ -37,6 +38,7 @@ namespace Grand.Web.Controllersreturn true;}+ [DenySystemAccount]public IActionResult Index(string name, [FromBody] Dictionary<string, object> arguments){@@ -92,6 +94,7 @@ namespace Grand.Web.Controllersreturn ViewComponent(name);}+ [DenySystemAccount]public IActionResult Form(string name){diff --git a/src/Web/Grand.Web/Controllers/DownloadController.cs b/src/Web/Grand.Web/Controllers/DownloadController.csindex ae5cc65e5..dcea253d5 100644--- a/src/Web/Grand.Web/Controllers/DownloadController.cs+++ b/src/Web/Grand.Web/Controllers/DownloadController.cs@@ -9,12 +9,14 @@ using Grand.Business.Storage.Interfaces;using Grand.Domain.Catalog;using Grand.Domain.Customers;using Grand.Infrastructure;+using Grand.Web.Common.Filters;using Microsoft.AspNetCore.Mvc;using System.IO.Compression;using System.Text.RegularExpressions;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class DownloadController : BasePublicController{private readonly IDownloadService _downloadService;diff --git a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web/Controllers/KnowledgebaseController.csindex 5985af583..9be31f657 100644--- a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs+++ b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs@@ -254,6 +254,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> ArticleCommentAdd(string articleId, KnowledgebaseArticleModel model, bool captchaValid,[FromServices] IWorkContext workContext,[FromServices] IGroupService groupService,diff --git a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.csindex 13d3c9f5a..bd56b5b23 100644--- a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs+++ b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs@@ -7,6 +7,7 @@ using Grand.Domain.Common;using Grand.Domain.Orders;using Grand.Infrastructure;using Grand.Web.Commands.Models.Orders;+using Grand.Web.Common.Filters;using Grand.Web.Extensions;using Grand.Web.Features.Models.Common;using Grand.Web.Features.Models.Orders;@@ -19,6 +20,7 @@ using Microsoft.Extensions.DependencyInjection;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class MerchandiseReturnController : BasePublicController{#region Fieldsdiff --git a/src/Web/Grand.Web/Controllers/NewsController.cs b/src/Web/Grand.Web/Controllers/NewsController.csindex be810ee37..65f889306 100644--- a/src/Web/Grand.Web/Controllers/NewsController.cs+++ b/src/Web/Grand.Web/Controllers/NewsController.cs@@ -95,6 +95,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> NewsCommentAdd(string newsItemId,NewsItemModel model, bool captchaValid,[FromServices] IGroupService groupServicediff --git a/src/Web/Grand.Web/Controllers/NewsletterController.cs b/src/Web/Grand.Web/Controllers/NewsletterController.csindex 5dea60f16..b9c39332c 100644--- a/src/Web/Grand.Web/Controllers/NewsletterController.cs+++ b/src/Web/Grand.Web/Controllers/NewsletterController.cs@@ -1,11 +1,13 @@using Grand.Web.Commands.Models.Newsletter;using Grand.Web.Common.Controllers;+using Grand.Web.Common.Filters;using MediatR;using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class NewsletterController : BasePublicController{private readonly IMediator _mediator;diff --git a/src/Web/Grand.Web/Controllers/OrderController.cs b/src/Web/Grand.Web/Controllers/OrderController.csindex 45257b813..5d899729a 100644--- a/src/Web/Grand.Web/Controllers/OrderController.cs+++ b/src/Web/Grand.Web/Controllers/OrderController.cs@@ -9,6 +9,7 @@ using Grand.Domain.Orders;using Grand.Domain.Shipping;using Grand.Infrastructure;using Grand.Web.Commands.Models.Orders;+using Grand.Web.Common.Filters;using Grand.Web.Events;using Grand.Web.Extensions;using Grand.Web.Features.Models.Orders;@@ -18,6 +19,7 @@ using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class OrderController : BasePublicController{#region Fieldsdiff --git a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.csindex 003e9e702..68c203f9f 100644--- a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs+++ b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs@@ -6,6 +6,7 @@ using Grand.Domain.Catalog;using Grand.Domain.Customers;using Grand.Domain.Orders;using Grand.Infrastructure;+using Grand.Web.Common.Filters;using Grand.Web.Features.Models.ShoppingCart;using Grand.Web.Models.Catalog;using MediatR;@@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Controllers{+ [DenySystemAccount]public partial class OutOfStockSubscriptionController : BasePublicController{#region Fieldsdiff --git a/src/Web/Grand.Web/Controllers/PageController.cs b/src/Web/Grand.Web/Controllers/PageController.csindex 02be39708..d3f5735ab 100644--- a/src/Web/Grand.Web/Controllers/PageController.cs+++ b/src/Web/Grand.Web/Controllers/PageController.cs@@ -2,6 +2,7 @@using Grand.Business.Common.Interfaces.Security;using Grand.Business.Common.Services.Security;using Grand.Infrastructure;+using Grand.Web.Common.Filters;using Grand.Web.Features.Models.Pages;using MediatR;using Microsoft.AspNetCore.Mvc;@@ -75,6 +76,7 @@ namespace Grand.Web.Controllersreturn View(layoutViewPath, model);}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> Authenticate(string id, string password){diff --git a/src/Web/Grand.Web/Controllers/ProductController.cs b/src/Web/Grand.Web/Controllers/ProductController.csindex 9ff3c51f8..6fd3df0f2 100644--- a/src/Web/Grand.Web/Controllers/ProductController.cs+++ b/src/Web/Grand.Web/Controllers/ProductController.cs@@ -484,6 +484,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> ProductReviews(string productId,ProductReviewsModel model,@@ -584,6 +585,7 @@ namespace Grand.Web.Controllers}[HttpPost]+ [DenySystemAccount]public virtual async Task<IActionResult> SetProductReviewHelpfulness(string productReviewId, string productId, bool washelpful,[FromServices] ICustomerService customerService,[FromServices] IGroupService groupService,@@ -660,6 +662,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> ProductEmailAFriend(ProductEmailAFriendModel model, bool captchaValid,[FromServices] IGroupService groupService){@@ -718,6 +721,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> AskQuestionOnProduct(ProductAskQuestionSimpleModel model, bool captchaValid){var product = await _productService.GetProductById(model.Id);diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.csindex 1ffb09e2d..decf91b1a 100644--- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs+++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs@@ -18,6 +18,7 @@ using Grand.Domain.Media;using Grand.Domain.Orders;using Grand.Infrastructure;using Grand.Web.Commands.Models.ShoppingCart;+using Grand.Web.Common.Filters;using Grand.Web.Features.Models.ShoppingCart;using MediatR;using Microsoft.AspNetCore.Http;@@ -114,6 +115,7 @@ namespace Grand.Web.Controllersreturn Json(model);}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> CheckoutAttributeChange(IFormCollection form,[FromServices] ICheckoutAttributeParser checkoutAttributeParser,@@ -163,6 +165,7 @@ namespace Grand.Web.Controllers});}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> UploadFileCheckoutAttribute(string attributeId,[FromServices] IDownloadService downloadService)@@ -281,6 +284,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> UpdateQuantity(string shoppingcartId, int quantity){@@ -336,6 +340,7 @@ namespace Grand.Web.Controllers}+ [DenySystemAccount]public virtual async Task<IActionResult> ClearCart(){if (!await _permissionService.Authorize(StandardPermission.EnableShoppingCart))@@ -352,6 +357,7 @@ namespace Grand.Web.Controllers}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> DeleteCartItem(string id, bool shoppingcartpage = false){@@ -409,6 +415,7 @@ namespace Grand.Web.Controllers}}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> ChangeTypeCartItem(string id, bool status = false){@@ -473,6 +480,7 @@ namespace Grand.Web.Controllers}}+ [DenySystemAccount]public virtual async Task<IActionResult> StartCheckout(IFormCollection form = null){var cart = await _shoppingCartService.GetShoppingCart(_workContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);@@ -512,6 +520,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> ApplyDiscountCoupon(string discountcouponcode){@@ -611,6 +620,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> ApplyGiftVoucher(string giftvouchercouponcode){@@ -690,6 +700,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> RemoveDiscountCoupon(string discountId){@@ -727,6 +738,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> RemoveGiftVoucherCode(string giftVoucherId, [FromServices] IGiftVoucherService giftVoucherService){diff --git a/src/Web/Grand.Web/Controllers/VendorController.cs b/src/Web/Grand.Web/Controllers/VendorController.csindex ae3e7c8b2..080d11835 100644--- a/src/Web/Grand.Web/Controllers/VendorController.cs+++ b/src/Web/Grand.Web/Controllers/VendorController.cs@@ -133,6 +133,7 @@ namespace Grand.Web.Controllers[HttpPost, ActionName("ApplyVendor")][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> ApplyVendorSubmit(ApplyVendorModel model, bool captchaValid, IFormFile uploadedFile){if (!_vendorSettings.AllowCustomersToApplyForVendorAccount)@@ -370,6 +371,7 @@ namespace Grand.Web.Controllers[HttpPost, ActionName("ContactVendor")][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> ContactVendor(ContactVendorModel model, bool captchaValid){if (!_vendorSettings.AllowCustomersToContactVendors)diff --git a/src/Web/Grand.Web/Controllers/WishlistController.cs b/src/Web/Grand.Web/Controllers/WishlistController.csindex ea8ebf135..af7546482 100644--- a/src/Web/Grand.Web/Controllers/WishlistController.cs+++ b/src/Web/Grand.Web/Controllers/WishlistController.cs@@ -114,6 +114,7 @@ namespace Grand.Web.Controllers}[AutoValidateAntiforgeryToken]+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> UpdateQuantity(string shoppingcartId, int quantity){@@ -155,6 +156,7 @@ namespace Grand.Web.Controllers}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> AddItemToCartFromWishlist(Guid? customerGuid, string shoppingcartId){@@ -193,6 +195,7 @@ namespace Grand.Web.Controllers}+ [DenySystemAccount][HttpPost]public virtual async Task<IActionResult> DeleteItemFromWishlist(string shoppingcartId){@@ -217,6 +220,7 @@ namespace Grand.Web.Controllers[HttpPost][AutoValidateAntiforgeryToken][ValidateCaptcha]+ [DenySystemAccount]public virtual async Task<IActionResult> EmailWishlist(WishlistEmailAFriendModel model, bool captchaValid,[FromServices] IMessageProviderService messageProviderService,[FromServices] CaptchaSettings captchaSettings)