1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 10:02:47 -05:00

[PM-5093][PM-7325] Added trial initiation email verification endpoint (#4221)

* Added trial initiation user verification endpoint

* Added explanatory comment for why we add artificial delay

* Updated RegistrationStart to Registration reference event

* Ensure that productTier query param is an int

* Added email value to trial initiation email
This commit is contained in:
Conner Turnbull
2024-07-29 14:18:12 -04:00
committed by GitHub
parent 2b738a5a4c
commit 656e0c20f9
12 changed files with 266 additions and 1 deletions

View File

@ -0,0 +1,10 @@
using Bit.Core.Auth.Models.Api.Request.Accounts;
using Bit.Core.Billing.Enums;
namespace Bit.Core.Billing.Models.Api.Requests.Accounts;
public class TrialSendVerificationEmailRequestModel : RegisterSendVerificationEmailRequestModel
{
public ProductTierType ProductTier { get; set; }
public IEnumerable<ProductType> Products { get; set; }
}

View File

@ -0,0 +1,33 @@
using Bit.Core.Auth.Models.Mail;
using Bit.Core.Billing.Enums;
namespace Bit.Core.Billing.Models.Mail;
public class TrialInitiationVerifyEmail : RegisterVerifyEmail
{
/// <summary>
/// See comment on <see cref="RegisterVerifyEmail"/>.<see cref="RegisterVerifyEmail.Url"/>
/// </summary>
public new string Url
{
get => $"{WebVaultUrl}/{Route}" +
$"?token={Token}" +
$"&email={Email}" +
$"&fromEmail=true" +
$"&productTier={(int)ProductTier}" +
$"&product={string.Join(",", Product.Select(p => (int)p))}";
}
public ProductTierType ProductTier { get; set; }
public IEnumerable<ProductType> Product { get; set; }
/// <summary>
/// Currently we only support one product type at a time, despite Product being a collection.
/// If we receive both PasswordManager and SecretsManager, we'll send the user to the PM trial route
/// </summary>
private string Route =>
Product.Any(p => p == ProductType.PasswordManager)
? "trial-initiation"
: "secrets-manager-trial-initiation";
}