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
Typo fix - Error message - API
KrzysztofPajakb1f40959ec8c
diff --git a/src/Business/Grand.Business.Authentication/Services/JwtBearerCustomerAuthenticationService.cs b/src/Business/Grand.Business.Authentication/Services/JwtBearerCustomerAuthenticationService.csindex b32a254c7..2f135405b 100644--- a/src/Business/Grand.Business.Authentication/Services/JwtBearerCustomerAuthenticationService.cs+++ b/src/Business/Grand.Business.Authentication/Services/JwtBearerCustomerAuthenticationService.cs@@ -20,8 +20,8 @@ namespace Grand.Business.Authentication.Servicesprivate readonly IRefreshTokenService _refreshTokenService;private string _errorMessage;- public JwtBearerCustomerAuthenticationService(ICustomerService customerService,IPermissionService permissionService- ,IUserFieldService userFieldService,IGroupService groupService,IRefreshTokenService refreshTokenService)+ public JwtBearerCustomerAuthenticationService(ICustomerService customerService, IPermissionService permissionService+ , IUserFieldService userFieldService, IGroupService groupService, IRefreshTokenService refreshTokenService){_customerService = customerService;_permissionService = permissionService;@@ -36,10 +36,10 @@ namespace Grand.Business.Authentication.Servicesvar passwordToken = context.Principal.Claims.ToList().FirstOrDefault(x => x.Type == "Token")?.Value;var refreshId = context.Principal.Claims.ToList().FirstOrDefault(x => x.Type == "RefreshId")?.Value;Customer customer = null;- if(email is null)+ if (email is null){//guest- var id= context.Principal.Claims.ToList().FirstOrDefault(x => x.Type == "Guid")?.Value;+ var id = context.Principal.Claims.ToList().FirstOrDefault(x => x.Type == "Guid")?.Value;customer = await _customerService.GetCustomerByGuid(Guid.Parse(id));}else@@ -52,33 +52,33 @@ namespace Grand.Business.Authentication.Servicesreturn false;}- if (customer == null || !customer.Active || customer.Deleted )+ if (customer == null || !customer.Active || customer.Deleted){_errorMessage = "Customer not exists/or not active in the customer table";return false;}var refreshToken = await _refreshTokenService.GetCustomerRefreshToken(customer);- if(refreshToken is null || string.IsNullOrEmpty(refreshId) || !refreshId.Equals(refreshToken?.RefreshId))+ if (refreshToken is null || string.IsNullOrEmpty(refreshId) || !refreshId.Equals(refreshToken?.RefreshId)){_errorMessage = "Invalid token or cancel by refresh token";return false;}- if (!(await _permissionService.Authorize(StandardPermission.AllowUseApi,customer)))+ if (!(await _permissionService.Authorize(StandardPermission.AllowUseApi, customer))){- _errorMessage = "Customer not has permission";+ _errorMessage = "You do not have permission to use API operation (Customer group)";return false;}var customerPasswordtoken = await _userFieldService.GetFieldsForEntity<string>(customer, SystemCustomerFieldNames.PasswordToken);var isGuest = await _groupService.IsGuest(customer);- if(!isGuest && (string.IsNullOrEmpty(passwordToken) || !passwordToken.Equals(customerPasswordtoken)))+ if (!isGuest && (string.IsNullOrEmpty(passwordToken) || !passwordToken.Equals(customerPasswordtoken))){_errorMessage = "Invalid password token, create new token";return false;}-+return true;}