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:
@ -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; }
|
||||
}
|
33
src/Core/Billing/Models/Mail/TrialInititaionVerifyEmail.cs
Normal file
33
src/Core/Billing/Models/Mail/TrialInititaionVerifyEmail.cs
Normal 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";
|
||||
}
|
Reference in New Issue
Block a user