mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
Use accept flow for sponsorship offers (#1964)
This commit is contained in:
parent
972657f982
commit
68f875b3d9
@ -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}";
|
||||
}
|
||||
}
|
@ -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}";
|
||||
}
|
||||
}
|
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user