diff --git a/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccountViewModel.cs b/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccountViewModel.cs deleted file mode 100644 index 82c86a03d..000000000 --- a/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccountViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Bit.Core.Models.Mail.FamiliesForEnterprise -{ - public class FamiliesForEnterpriseOfferExistingAccountViewModel : BaseMailModel - { - public string SponsorEmail { get; set; } - public string SponsoredEmail { get; set; } - public string SponsorshipToken { get; set; } - public string Url => $"{WebVaultUrl}/?sponsorshipToken={SponsorshipToken}&email={SponsoredEmail}"; - } -} diff --git a/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferNewAccountViewModel.cs b/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferNewAccountViewModel.cs deleted file mode 100644 index 52462296a..000000000 --- a/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferNewAccountViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Bit.Core.Models.Mail.FamiliesForEnterprise -{ - public class FamiliesForEnterpriseOfferNewAccountViewModel : BaseMailModel - { - public string SponsorEmail { get; set; } - public string SponsoredEmail { get; set; } - public string SponsorshipToken { get; set; } - public string Url => $"{WebVaultUrl}/register?sponsorshipToken={SponsorshipToken}&email={SponsoredEmail}"; - } -} diff --git a/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferViewModel.cs b/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferViewModel.cs new file mode 100644 index 000000000..9a30d98d1 --- /dev/null +++ b/src/Core/Models/Mail/FamiliesForEnterprise/FamiliesForEnterpriseOfferViewModel.cs @@ -0,0 +1,17 @@ +namespace Bit.Core.Models.Mail.FamiliesForEnterprise +{ + public class FamiliesForEnterpriseOfferViewModel : BaseMailModel + { + public string SponsorEmail { get; set; } + public string SponsoredEmail { get; set; } + public string SponsorshipToken { get; set; } + public bool ExistingAccount { get; set; } + public string Url => string.Concat( + WebVaultUrl, + "/accept-families-for-enterprise", + $"?token={SponsorshipToken}", + $"&email={SponsoredEmail}", + ExistingAccount ? "" : "®ister=true" + ); + } +} diff --git a/src/Core/Services/Implementations/HandlebarsMailService.cs b/src/Core/Services/Implementations/HandlebarsMailService.cs index dca7a032b..461bf283a 100644 --- a/src/Core/Services/Implementations/HandlebarsMailService.cs +++ b/src/Core/Services/Implementations/HandlebarsMailService.cs @@ -807,32 +807,20 @@ namespace Bit.Core.Services { var message = CreateDefaultMessage("Accept Your Free Families Subscription", email); - if (existingAccount) + var model = new FamiliesForEnterpriseOfferViewModel { - var model = new FamiliesForEnterpriseOfferExistingAccountViewModel - { - SponsorEmail = CoreHelpers.ObfuscateEmail(sponsorEmail), - SponsoredEmail = WebUtility.UrlEncode(email), - WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, - SiteName = _globalSettings.SiteName, - SponsorshipToken = token, - }; + SponsorEmail = CoreHelpers.ObfuscateEmail(sponsorEmail), + SponsoredEmail = WebUtility.UrlEncode(email), + ExistingAccount = existingAccount, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, + SiteName = _globalSettings.SiteName, + SponsorshipToken = token, + }; + var templateName = existingAccount ? + "FamiliesForEnterprise.FamiliesForEnterpriseOfferExistingAccount" : + "FamiliesForEnterprise.FamiliesForEnterpriseOfferNewAccount"; - await AddMessageContentAsync(message, "FamiliesForEnterprise.FamiliesForEnterpriseOfferExistingAccount", model); - } - else - { - var model = new FamiliesForEnterpriseOfferNewAccountViewModel - { - SponsorEmail = sponsorEmail, - SponsoredEmail = WebUtility.UrlEncode(email), - WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, - SiteName = _globalSettings.SiteName, - SponsorshipToken = token, - }; - - await AddMessageContentAsync(message, "FamiliesForEnterprise.FamiliesForEnterpriseOfferNewAccount", model); - } + await AddMessageContentAsync(message, templateName, model); message.Category = "FamiliesForEnterpriseOffer"; await _mailDeliveryService.SendEmailAsync(message);