mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
AC 2266 two email notifications is sent when creating org from sm trial (#3878)
* remove the unwanted test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Fix the double email issue Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Resolve the bug issue Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * change the category name Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * move private down the class Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * move the private method down the class file Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add the RegisterUser Test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * modify the test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * remove the failing test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * revert the test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * add the email method Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * revert changes on the UserServiceTests.cs Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
@ -538,14 +538,6 @@ public class OrganizationService : IOrganizationService
|
||||
// TODO: add reference events for SmSeats and Service Accounts - see AC-1481
|
||||
});
|
||||
|
||||
var isAc2101UpdateTrialInitiationEmail =
|
||||
_featureService.IsEnabled(FeatureFlagKeys.AC2101UpdateTrialInitiationEmail);
|
||||
|
||||
if (signup.IsFromSecretsManagerTrial && isAc2101UpdateTrialInitiationEmail)
|
||||
{
|
||||
await _mailService.SendTrialInitiationEmailAsync(signup.BillingEmail);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
@ -346,6 +346,7 @@ public class UserService : UserManager<User>, IUserService, IDisposable
|
||||
if (referenceData.TryGetValue("initiationPath", out var value))
|
||||
{
|
||||
var initiationPath = value.ToString();
|
||||
await SendAppropriateWelcomeEmailAsync(user, initiationPath);
|
||||
if (!string.IsNullOrEmpty(initiationPath))
|
||||
{
|
||||
await _referenceEventService.RaiseEventAsync(
|
||||
@ -1453,4 +1454,18 @@ public class UserService : UserManager<User>, IUserService, IDisposable
|
||||
|
||||
return isVerified;
|
||||
}
|
||||
|
||||
private async Task SendAppropriateWelcomeEmailAsync(User user, string initiationPath)
|
||||
{
|
||||
var isFromMarketingWebsite = initiationPath.Contains("Secrets Manager trial");
|
||||
|
||||
if (isFromMarketingWebsite)
|
||||
{
|
||||
await _mailService.SendTrialInitiationEmailAsync(user.Email);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _mailService.SendWelcomeEmailAsync(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user