From 8d796d4a1e6862836d793fd9f39b646b873dc612 Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Sun, 19 Jul 2026 19:29:52 +0200 Subject: [PATCH] Fix DI resolution error in ProductEmailAFriendValidator The constructor requested the concrete GoogleReCaptchaValidator type, but it is only registered in the container under its interface via AddHttpClient(). This threw System.InvalidOperationException: Unable to resolve service for type 'GoogleReCaptchaValidator' whenever the "Email a friend" form was submitted with captcha enabled. Every other captcha validator in the codebase already depends on the interface. Co-Authored-By: Claude Sonnet 5 --- .../Validators/Catalog/ProductEmailAFriendValidator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs b/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs index 4fa2705ff..273b4527a 100644 --- a/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs +++ b/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs @@ -7,7 +7,7 @@ using Grand.Infrastructure; using Grand.Infrastructure.Models; using Grand.Infrastructure.Validators; -using Grand.Web.Common.Security.Captcha; +using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Catalog; @@ -20,7 +20,7 @@ public ProductEmailAFriendValidator( IEnumerable> validatorsCaptcha, CaptchaSettings captchaSettings, CatalogSettings catalogSettings, IContextAccessor contextAccessor, IGroupService groupService, IProductService productService, - IHttpContextAccessor httpcontextAccessor, GoogleReCaptchaValidator googleReCaptchaValidator, + IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, ITranslationService translationService) : base(validators) {