1
0
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:
cyprain-okeke 2025-02-19 13:13:48 +01:00 committed by GitHub
parent f27886e312
commit fcb9848180
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 8 deletions

View File

@ -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";
}
}
}

View File

@ -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;
}

View File

@ -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,

View File

@ -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,

View File

@ -26,6 +26,7 @@ public class NoopMailService : IMailService
}
public Task SendTrialInitiationSignupEmailAsync(
bool isExistingUser,
string email,
string token,
ProductTierType productTier,