mirror of
https://github.com/bitwarden/server.git
synced 2025-01-19 21:21:22 +01:00
Update unclaimed domains email copy (#5116)
This commit is contained in:
parent
c99b4106f5
commit
170836aba1
@ -17,6 +17,7 @@ public class OrganizationDomainService : IOrganizationDomainService
|
|||||||
private readonly TimeProvider _timeProvider;
|
private readonly TimeProvider _timeProvider;
|
||||||
private readonly ILogger<OrganizationDomainService> _logger;
|
private readonly ILogger<OrganizationDomainService> _logger;
|
||||||
private readonly IGlobalSettings _globalSettings;
|
private readonly IGlobalSettings _globalSettings;
|
||||||
|
private readonly IFeatureService _featureService;
|
||||||
|
|
||||||
public OrganizationDomainService(
|
public OrganizationDomainService(
|
||||||
IOrganizationDomainRepository domainRepository,
|
IOrganizationDomainRepository domainRepository,
|
||||||
@ -26,7 +27,8 @@ public class OrganizationDomainService : IOrganizationDomainService
|
|||||||
IVerifyOrganizationDomainCommand verifyOrganizationDomainCommand,
|
IVerifyOrganizationDomainCommand verifyOrganizationDomainCommand,
|
||||||
TimeProvider timeProvider,
|
TimeProvider timeProvider,
|
||||||
ILogger<OrganizationDomainService> logger,
|
ILogger<OrganizationDomainService> logger,
|
||||||
IGlobalSettings globalSettings)
|
IGlobalSettings globalSettings,
|
||||||
|
IFeatureService featureService)
|
||||||
{
|
{
|
||||||
_domainRepository = domainRepository;
|
_domainRepository = domainRepository;
|
||||||
_organizationUserRepository = organizationUserRepository;
|
_organizationUserRepository = organizationUserRepository;
|
||||||
@ -36,6 +38,7 @@ public class OrganizationDomainService : IOrganizationDomainService
|
|||||||
_timeProvider = timeProvider;
|
_timeProvider = timeProvider;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_globalSettings = globalSettings;
|
_globalSettings = globalSettings;
|
||||||
|
_featureService = featureService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ValidateOrganizationsDomainAsync()
|
public async Task ValidateOrganizationsDomainAsync()
|
||||||
@ -89,10 +92,18 @@ public class OrganizationDomainService : IOrganizationDomainService
|
|||||||
|
|
||||||
//Send email to administrators
|
//Send email to administrators
|
||||||
if (adminEmails.Count > 0)
|
if (adminEmails.Count > 0)
|
||||||
|
{
|
||||||
|
if (_featureService.IsEnabled(FeatureFlagKeys.AccountDeprovisioning))
|
||||||
|
{
|
||||||
|
await _mailService.SendUnclaimedOrganizationDomainEmailAsync(adminEmails,
|
||||||
|
domain.OrganizationId.ToString(), domain.DomainName);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await _mailService.SendUnverifiedOrganizationDomainEmailAsync(adminEmails,
|
await _mailService.SendUnverifiedOrganizationDomainEmailAsync(adminEmails,
|
||||||
domain.OrganizationId.ToString(), domain.DomainName);
|
domain.OrganizationId.ToString(), domain.DomainName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Expired domain: {domainName}", domain.DomainName);
|
_logger.LogInformation(Constants.BypassFiltersEventId, "Expired domain: {domainName}", domain.DomainName);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
{{#>FullHtmlLayout}}
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<tr style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none; text-align: left;" valign="top">
|
||||||
|
The domain {{DomainName}} in your Bitwarden organization could not be claimed.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none;" valign="top">
|
||||||
|
Check the corresponding record in your domain host. Then reclaim this domain in Bitwarden to use it for your organization.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none;" valign="top">
|
||||||
|
The domain will be removed from your organization in 7 days if it is not claimed.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none; text-align: center;" valign="top" align="center">
|
||||||
|
<a href="{{{Url}}}" clicktracking=off target="_blank" style="color: #ffffff; text-decoration: none; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; background-color: #175DDC; border-color: #175DDC; border-style: solid; border-width: 10px 20px; margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
Manage Domains
|
||||||
|
</a>
|
||||||
|
<br style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{{/FullHtmlLayout}}
|
@ -0,0 +1,10 @@
|
|||||||
|
{{#>BasicTextLayout}}
|
||||||
|
The domain {{DomainName}} in your Bitwarden organization could not be claimed.
|
||||||
|
|
||||||
|
Check the corresponding record in your domain host. Then reclaim this domain in Bitwarden to use it for your organization.
|
||||||
|
|
||||||
|
The domain will be removed from your organization in 7 days if it is not claimed.
|
||||||
|
|
||||||
|
{{Url}}
|
||||||
|
|
||||||
|
{{/BasicTextLayout}}
|
@ -85,6 +85,7 @@ public interface IMailService
|
|||||||
Task SendFailedLoginAttemptsEmailAsync(string email, DateTime utcNow, string ip);
|
Task SendFailedLoginAttemptsEmailAsync(string email, DateTime utcNow, string ip);
|
||||||
Task SendFailedTwoFactorAttemptsEmailAsync(string email, DateTime utcNow, string ip);
|
Task SendFailedTwoFactorAttemptsEmailAsync(string email, DateTime utcNow, string ip);
|
||||||
Task SendUnverifiedOrganizationDomainEmailAsync(IEnumerable<string> adminEmails, string organizationId, string domainName);
|
Task SendUnverifiedOrganizationDomainEmailAsync(IEnumerable<string> adminEmails, string organizationId, string domainName);
|
||||||
|
Task SendUnclaimedOrganizationDomainEmailAsync(IEnumerable<string> adminEmails, string organizationId, string domainName);
|
||||||
Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
||||||
Task SendSecretsManagerMaxServiceAccountLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
Task SendSecretsManagerMaxServiceAccountLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
||||||
Task SendTrustedDeviceAdminApprovalEmailAsync(string email, DateTime utcNow, string ip, string deviceTypeAndIdentifier);
|
Task SendTrustedDeviceAdminApprovalEmailAsync(string email, DateTime utcNow, string ip, string deviceTypeAndIdentifier);
|
||||||
|
@ -1068,6 +1068,19 @@ public class HandlebarsMailService : IMailService
|
|||||||
await _mailDeliveryService.SendEmailAsync(message);
|
await _mailDeliveryService.SendEmailAsync(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task SendUnclaimedOrganizationDomainEmailAsync(IEnumerable<string> adminEmails, string organizationId, string domainName)
|
||||||
|
{
|
||||||
|
var message = CreateDefaultMessage("Domain not claimed", adminEmails);
|
||||||
|
var model = new OrganizationDomainUnverifiedViewModel
|
||||||
|
{
|
||||||
|
Url = $"{_globalSettings.BaseServiceUri.VaultWithHash}/organizations/{organizationId}/settings/domain-verification",
|
||||||
|
DomainName = domainName
|
||||||
|
};
|
||||||
|
await AddMessageContentAsync(message, "OrganizationDomainUnclaimed", model);
|
||||||
|
message.Category = "UnclaimedOrganizationDomain";
|
||||||
|
await _mailDeliveryService.SendEmailAsync(message);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount,
|
public async Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount,
|
||||||
IEnumerable<string> ownerEmails)
|
IEnumerable<string> ownerEmails)
|
||||||
{
|
{
|
||||||
|
@ -273,6 +273,11 @@ public class NoopMailService : IMailService
|
|||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task SendUnclaimedOrganizationDomainEmailAsync(IEnumerable<string> adminEmails, string organizationId, string domainName)
|
||||||
|
{
|
||||||
|
return Task.FromResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
public Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount,
|
public Task SendSecretsManagerMaxSeatLimitReachedEmailAsync(Organization organization, int maxSeatCount,
|
||||||
IEnumerable<string> ownerEmails)
|
IEnumerable<string> ownerEmails)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user