mirror of
https://github.com/bitwarden/server.git
synced 2025-04-08 06:28:14 -05:00
[AC 2261] Emails - direct Secrets Manager members to Secrets Manager product (#3896)
* remove the unwanted test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * initial commit Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * changes to the sm redirect Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * revert the sm changes for join org Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
parent
c5d5de0aed
commit
1a066d886c
@ -1277,7 +1277,7 @@ public class OrganizationService : IOrganizationService
|
|||||||
orgUser.Email = null;
|
orgUser.Email = null;
|
||||||
|
|
||||||
await _eventService.LogOrganizationUserEventAsync(orgUser, EventType.OrganizationUser_Confirmed);
|
await _eventService.LogOrganizationUserEventAsync(orgUser, EventType.OrganizationUser_Confirmed);
|
||||||
await _mailService.SendOrganizationConfirmedEmailAsync(organization.DisplayName(), user.Email);
|
await _mailService.SendOrganizationConfirmedEmailAsync(organization.DisplayName(), user.Email, orgUser.AccessSecretsManager);
|
||||||
await DeleteAndPushUserRegistrationAsync(organizationId, user.Id);
|
await DeleteAndPushUserRegistrationAsync(organizationId, user.Id);
|
||||||
succeededUsers.Add(orgUser);
|
succeededUsers.Add(orgUser);
|
||||||
result.Add(Tuple.Create(orgUser, ""));
|
result.Add(Tuple.Create(orgUser, ""));
|
||||||
|
@ -22,14 +22,18 @@ public class OrganizationUserInvitedViewModel : BaseTitleContactUsMailModel
|
|||||||
return new OrganizationUserInvitedViewModel
|
return new OrganizationUserInvitedViewModel
|
||||||
{
|
{
|
||||||
TitleFirst = orgInvitesInfo.IsFreeOrg ? freeOrgTitle : "Join ",
|
TitleFirst = orgInvitesInfo.IsFreeOrg ? freeOrgTitle : "Join ",
|
||||||
TitleSecondBold = orgInvitesInfo.IsFreeOrg ? string.Empty : CoreHelpers.SanitizeForEmail(orgInvitesInfo.OrganizationName, false),
|
TitleSecondBold =
|
||||||
|
orgInvitesInfo.IsFreeOrg
|
||||||
|
? string.Empty
|
||||||
|
: CoreHelpers.SanitizeForEmail(orgInvitesInfo.OrganizationName, false),
|
||||||
TitleThird = orgInvitesInfo.IsFreeOrg ? string.Empty : " on Bitwarden and start securing your passwords!",
|
TitleThird = orgInvitesInfo.IsFreeOrg ? string.Empty : " on Bitwarden and start securing your passwords!",
|
||||||
OrganizationName = CoreHelpers.SanitizeForEmail(orgInvitesInfo.OrganizationName, false) + orgUser.Status,
|
OrganizationName = CoreHelpers.SanitizeForEmail(orgInvitesInfo.OrganizationName, false) + orgUser.Status,
|
||||||
Email = WebUtility.UrlEncode(orgUser.Email),
|
Email = WebUtility.UrlEncode(orgUser.Email),
|
||||||
OrganizationId = orgUser.OrganizationId.ToString(),
|
OrganizationId = orgUser.OrganizationId.ToString(),
|
||||||
OrganizationUserId = orgUser.Id.ToString(),
|
OrganizationUserId = orgUser.Id.ToString(),
|
||||||
Token = WebUtility.UrlEncode(expiringToken.Token),
|
Token = WebUtility.UrlEncode(expiringToken.Token),
|
||||||
ExpirationDate = $"{expiringToken.ExpirationDate.ToLongDateString()} {expiringToken.ExpirationDate.ToShortTimeString()} UTC",
|
ExpirationDate =
|
||||||
|
$"{expiringToken.ExpirationDate.ToLongDateString()} {expiringToken.ExpirationDate.ToShortTimeString()} UTC",
|
||||||
OrganizationNameUrlEncoded = WebUtility.UrlEncode(orgInvitesInfo.OrganizationName),
|
OrganizationNameUrlEncoded = WebUtility.UrlEncode(orgInvitesInfo.OrganizationName),
|
||||||
WebVaultUrl = globalSettings.BaseServiceUri.VaultWithHash,
|
WebVaultUrl = globalSettings.BaseServiceUri.VaultWithHash,
|
||||||
SiteName = globalSettings.SiteName,
|
SiteName = globalSettings.SiteName,
|
||||||
|
@ -24,8 +24,8 @@ public interface IMailService
|
|||||||
Task SendOrganizationInviteEmailsAsync(OrganizationInvitesInfo orgInvitesInfo);
|
Task SendOrganizationInviteEmailsAsync(OrganizationInvitesInfo orgInvitesInfo);
|
||||||
Task SendOrganizationMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
Task SendOrganizationMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
||||||
Task SendOrganizationAutoscaledEmailAsync(Organization organization, int initialSeatCount, IEnumerable<string> ownerEmails);
|
Task SendOrganizationAutoscaledEmailAsync(Organization organization, int initialSeatCount, IEnumerable<string> ownerEmails);
|
||||||
Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier, IEnumerable<string> adminEmails);
|
Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier, IEnumerable<string> adminEmails, bool hasAccessSecretsManager = false);
|
||||||
Task SendOrganizationConfirmedEmailAsync(string organizationName, string email);
|
Task SendOrganizationConfirmedEmailAsync(string organizationName, string email, bool hasAccessSecretsManager = false);
|
||||||
Task SendOrganizationUserRemovedForPolicyTwoStepEmailAsync(string organizationName, string email);
|
Task SendOrganizationUserRemovedForPolicyTwoStepEmailAsync(string organizationName, string email);
|
||||||
Task SendPasswordlessSignInAsync(string returnUrl, string token, string email);
|
Task SendPasswordlessSignInAsync(string returnUrl, string token, string email);
|
||||||
Task SendInvoiceUpcoming(
|
Task SendInvoiceUpcoming(
|
||||||
|
@ -173,7 +173,7 @@ public class HandlebarsMailService : IMailService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier,
|
public async Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier,
|
||||||
IEnumerable<string> adminEmails)
|
IEnumerable<string> adminEmails, bool hasAccessSecretsManager = false)
|
||||||
{
|
{
|
||||||
var message = CreateDefaultMessage($"Action Required: {userIdentifier} Needs to Be Confirmed", adminEmails);
|
var message = CreateDefaultMessage($"Action Required: {userIdentifier} Needs to Be Confirmed", adminEmails);
|
||||||
var model = new OrganizationUserAcceptedViewModel
|
var model = new OrganizationUserAcceptedViewModel
|
||||||
@ -189,7 +189,7 @@ public class HandlebarsMailService : IMailService
|
|||||||
await _mailDeliveryService.SendEmailAsync(message);
|
await _mailDeliveryService.SendEmailAsync(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendOrganizationConfirmedEmailAsync(string organizationName, string email)
|
public async Task SendOrganizationConfirmedEmailAsync(string organizationName, string email, bool hasAccessSecretsManager = false)
|
||||||
{
|
{
|
||||||
var message = CreateDefaultMessage($"You Have Been Confirmed To {organizationName}", email);
|
var message = CreateDefaultMessage($"You Have Been Confirmed To {organizationName}", email);
|
||||||
var model = new OrganizationUserConfirmedViewModel
|
var model = new OrganizationUserConfirmedViewModel
|
||||||
@ -198,7 +198,9 @@ public class HandlebarsMailService : IMailService
|
|||||||
TitleSecondBold = CoreHelpers.SanitizeForEmail(organizationName, false),
|
TitleSecondBold = CoreHelpers.SanitizeForEmail(organizationName, false),
|
||||||
TitleThird = "!",
|
TitleThird = "!",
|
||||||
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false),
|
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false),
|
||||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
WebVaultUrl = hasAccessSecretsManager
|
||||||
|
? _globalSettings.BaseServiceUri.VaultWithHashAndSecretManagerProduct
|
||||||
|
: _globalSettings.BaseServiceUri.VaultWithHash,
|
||||||
SiteName = _globalSettings.SiteName
|
SiteName = _globalSettings.SiteName
|
||||||
};
|
};
|
||||||
await AddMessageContentAsync(message, "OrganizationUserConfirmed", model);
|
await AddMessageContentAsync(message, "OrganizationUserConfirmed", model);
|
||||||
@ -216,6 +218,7 @@ public class HandlebarsMailService : IMailService
|
|||||||
|
|
||||||
var messageModels = orgInvitesInfo.OrgUserTokenPairs.Select(orgUserTokenPair =>
|
var messageModels = orgInvitesInfo.OrgUserTokenPairs.Select(orgUserTokenPair =>
|
||||||
{
|
{
|
||||||
|
|
||||||
var orgUserInviteViewModel = OrganizationUserInvitedViewModel.CreateFromInviteInfo(
|
var orgUserInviteViewModel = OrganizationUserInvitedViewModel.CreateFromInviteInfo(
|
||||||
orgInvitesInfo, orgUserTokenPair.OrgUser, orgUserTokenPair.Token, _globalSettings);
|
orgInvitesInfo, orgUserTokenPair.OrgUser, orgUserTokenPair.Token, _globalSettings);
|
||||||
return CreateMessage(orgUserTokenPair.OrgUser.Email, orgUserInviteViewModel);
|
return CreateMessage(orgUserTokenPair.OrgUser.Email, orgUserInviteViewModel);
|
||||||
@ -256,7 +259,7 @@ public class HandlebarsMailService : IMailService
|
|||||||
var message = CreateDefaultMessage("Welcome to Bitwarden!", userEmail);
|
var message = CreateDefaultMessage("Welcome to Bitwarden!", userEmail);
|
||||||
var model = new BaseMailModel
|
var model = new BaseMailModel
|
||||||
{
|
{
|
||||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHashAndSecretManagerProduct,
|
||||||
SiteName = _globalSettings.SiteName
|
SiteName = _globalSettings.SiteName
|
||||||
};
|
};
|
||||||
await AddMessageContentAsync(message, "TrialInitiation", model);
|
await AddMessageContentAsync(message, "TrialInitiation", model);
|
||||||
|
@ -43,12 +43,13 @@ public class NoopMailService : IMailService
|
|||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier, IEnumerable<string> adminEmails)
|
public Task SendOrganizationAcceptedEmailAsync(Organization organization, string userIdentifier,
|
||||||
|
IEnumerable<string> adminEmails, bool hasAccessSecretsManager = false)
|
||||||
{
|
{
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SendOrganizationConfirmedEmailAsync(string organizationName, string email)
|
public Task SendOrganizationConfirmedEmailAsync(string organizationName, string email, bool hasAccessSecretsManager = false)
|
||||||
{
|
{
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,7 @@ public class GlobalSettings : IGlobalSettings
|
|||||||
public string CloudRegion { get; set; }
|
public string CloudRegion { get; set; }
|
||||||
public string Vault { get; set; }
|
public string Vault { get; set; }
|
||||||
public string VaultWithHash => $"{Vault}/#";
|
public string VaultWithHash => $"{Vault}/#";
|
||||||
|
public string VaultWithHashAndSecretManagerProduct => $"{Vault}/#/sm";
|
||||||
|
|
||||||
public string Api
|
public string Api
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ public interface IBaseServiceUriSettings
|
|||||||
string CloudRegion { get; set; }
|
string CloudRegion { get; set; }
|
||||||
string Vault { get; set; }
|
string Vault { get; set; }
|
||||||
string VaultWithHash { get; }
|
string VaultWithHash { get; }
|
||||||
|
string VaultWithHashAndSecretManagerProduct { get; }
|
||||||
string Api { get; set; }
|
string Api { get; set; }
|
||||||
public string Identity { get; set; }
|
public string Identity { get; set; }
|
||||||
public string Admin { get; set; }
|
public string Admin { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user