mirror of
https://github.com/bitwarden/server.git
synced 2025-03-12 13:29:14 +01:00
[PM-13620]Existing user email linking to create-organization (#5315)
* Changes for the existing customer Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * removed the added character Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
parent
f27886e312
commit
fcb9848180
@ -5,6 +5,7 @@ namespace Bit.Core.Billing.Models.Mail;
|
||||
|
||||
public class TrialInitiationVerifyEmail : RegisterVerifyEmail
|
||||
{
|
||||
public bool IsExistingUser { get; set; }
|
||||
/// <summary>
|
||||
/// See comment on <see cref="RegisterVerifyEmail"/>.<see cref="RegisterVerifyEmail.Url"/>
|
||||
/// </summary>
|
||||
@ -26,8 +27,18 @@ public class TrialInitiationVerifyEmail : RegisterVerifyEmail
|
||||
/// 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";
|
||||
private string Route
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsExistingUser)
|
||||
{
|
||||
return "create-organization";
|
||||
}
|
||||
|
||||
return Product.Any(p => p == ProductType.PasswordManager)
|
||||
? "trial-initiation"
|
||||
: "secrets-manager-trial-initiation";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,10 +43,7 @@ public class SendTrialInitiationEmailForRegistrationCommand(
|
||||
|
||||
await PerformConstantTimeOperationsAsync();
|
||||
|
||||
if (!userExists)
|
||||
{
|
||||
await mailService.SendTrialInitiationSignupEmailAsync(email, token, productTier, products);
|
||||
}
|
||||
await mailService.SendTrialInitiationSignupEmailAsync(userExists, email, token, productTier, products);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public interface IMailService
|
||||
Task SendVerifyEmailEmailAsync(string email, Guid userId, string token);
|
||||
Task SendRegistrationVerificationEmailAsync(string email, string token);
|
||||
Task SendTrialInitiationSignupEmailAsync(
|
||||
bool isExistingUser,
|
||||
string email,
|
||||
string token,
|
||||
ProductTierType productTier,
|
||||
|
@ -74,6 +74,7 @@ public class HandlebarsMailService : IMailService
|
||||
}
|
||||
|
||||
public async Task SendTrialInitiationSignupEmailAsync(
|
||||
bool isExistingUser,
|
||||
string email,
|
||||
string token,
|
||||
ProductTierType productTier,
|
||||
@ -82,6 +83,7 @@ public class HandlebarsMailService : IMailService
|
||||
var message = CreateDefaultMessage("Verify your email", email);
|
||||
var model = new TrialInitiationVerifyEmail
|
||||
{
|
||||
IsExistingUser = isExistingUser,
|
||||
Token = WebUtility.UrlEncode(token),
|
||||
Email = WebUtility.UrlEncode(email),
|
||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
||||
|
@ -26,6 +26,7 @@ public class NoopMailService : IMailService
|
||||
}
|
||||
|
||||
public Task SendTrialInitiationSignupEmailAsync(
|
||||
bool isExistingUser,
|
||||
string email,
|
||||
string token,
|
||||
ProductTierType productTier,
|
||||
|
Loading…
Reference in New Issue
Block a user