From a2467ea6eaecfb19fbf0989f1edded098764aafb Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Tue, 9 Nov 2021 21:12:27 -0500 Subject: [PATCH] Add product type to organization details --- .../Models/Api/Response/ProfileOrganizationResponseModel.cs | 2 ++ .../Implementations/OrganizationSponsorshipService.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Core/Models/Api/Response/ProfileOrganizationResponseModel.cs b/src/Core/Models/Api/Response/ProfileOrganizationResponseModel.cs index 3a4f90e430..d094a323b2 100644 --- a/src/Core/Models/Api/Response/ProfileOrganizationResponseModel.cs +++ b/src/Core/Models/Api/Response/ProfileOrganizationResponseModel.cs @@ -42,6 +42,7 @@ namespace Bit.Core.Models.Api FamilySponsorshipAvailable = FamilySponsorshipFriendlyName == null && Utilities.StaticStore.GetSponsoredPlan(PlanSponsorshipType.FamiliesForEnterprise) .UsersCanSponsor(organization); + PlanProductType = Utilities.StaticStore.GetPlan(organization.PlanType).Product; } public string Id { get; set; } @@ -74,5 +75,6 @@ namespace Bit.Core.Models.Api public string ProviderName { get; set; } public string FamilySponsorshipFriendlyName { get; set; } public bool FamilySponsorshipAvailable { get; set; } + public ProductType PlanProductType { get; set; } } } diff --git a/src/Core/Services/Implementations/OrganizationSponsorshipService.cs b/src/Core/Services/Implementations/OrganizationSponsorshipService.cs index 79250323c0..6e870a88b3 100644 --- a/src/Core/Services/Implementations/OrganizationSponsorshipService.cs +++ b/src/Core/Services/Implementations/OrganizationSponsorshipService.cs @@ -40,10 +40,10 @@ namespace Bit.Core.Services return false; } - var decryptedToken = _dataProtector.Unprotect(encryptedToken); + var decryptedToken = _dataProtector.Unprotect(encryptedToken[TokenClearTextPrefix.Length..]); var dataParts = decryptedToken.Split(' '); - if (dataParts.Length != 2) + if (dataParts.Length != 3) { return false; }