1
0
mirror of https://github.com/bitwarden/server synced 2025-12-16 08:13:33 +00:00

[PM-1095][PM-1104] Update email template (#2746)

* [SG-994] Add import Open Sans font to full template

* [SG-994] Update organization user invite email template to new UI

* [SG-994] update alt text for mobile app download buttons

* [SG-994] Update copy. Add hyperlinks to stores.

* [SG-944] Improve layout responsiveness

* [PM-1095][PM-1104] Add new template for title and contact us. Add new template for user organization invite

* [PM-1095][PM-1104] Remove wrong text from free invite

* [PM-1104][PM-1095] Add bold class. Add margin.

* [PM-1104][PM-1095] Change font type to previously used

* [PM-1104][PM-1095] Remove Open Sans font

* [PM-1104][PM-1095] Improve browsers rendering compatibility

* [PM-1104][PM-1095] Fixed margins

* [PM-1095][PM-1104] Remove unnecessary string sanitise.
This commit is contained in:
André Bispo
2023-03-21 14:44:58 +00:00
committed by GitHub
parent 3d0ca908ff
commit 2e3e96a25c
15 changed files with 232 additions and 123 deletions

View File

@@ -191,6 +191,9 @@ public class HandlebarsMailService : IMailService
var message = CreateDefaultMessage($"You Have Been Confirmed To {organizationName}", email);
var model = new OrganizationUserConfirmedViewModel
{
TitleFirst = "You're confirmed as a member of ",
TitleSecondBold = CoreHelpers.SanitizeForEmail(organizationName, false),
TitleThird = "!",
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false),
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName
@@ -200,21 +203,24 @@ public class HandlebarsMailService : IMailService
await _mailDeliveryService.SendEmailAsync(message);
}
public Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, ExpiringToken token) =>
BulkSendOrganizationInviteEmailAsync(organizationName, new[] { (orgUser, token) });
public Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, ExpiringToken token, bool isFreeOrg) =>
BulkSendOrganizationInviteEmailAsync(organizationName, new[] { (orgUser, token) }, isFreeOrg);
public async Task BulkSendOrganizationInviteEmailAsync(string organizationName, IEnumerable<(OrganizationUser orgUser, ExpiringToken token)> invites)
public async Task BulkSendOrganizationInviteEmailAsync(string organizationName, IEnumerable<(OrganizationUser orgUser, ExpiringToken token)> invites, bool isFreeOrg)
{
MailQueueMessage CreateMessage(string email, object model)
{
var message = CreateDefaultMessage($"Join {organizationName}", email);
return new MailQueueMessage(message, "OrganizationUserInvited", model);
}
var freeOrgTitle = "A Bitwarden member invited you to an organization. Join now to start securing your passwords!";
var messageModels = invites.Select(invite => CreateMessage(invite.orgUser.Email,
new OrganizationUserInvitedViewModel
{
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false),
TitleFirst = isFreeOrg ? freeOrgTitle : "Join ",
TitleSecondBold = isFreeOrg ? string.Empty : CoreHelpers.SanitizeForEmail(organizationName, false),
TitleThird = isFreeOrg ? string.Empty : " on Bitwarden and start securing your passwords!",
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false) + invite.orgUser.Status,
Email = WebUtility.UrlEncode(invite.orgUser.Email),
OrganizationId = invite.orgUser.OrganizationId.ToString(),
OrganizationUserId = invite.orgUser.Id.ToString(),
@@ -478,6 +484,10 @@ public class HandlebarsMailService : IMailService
Handlebars.RegisterTemplate("FullHtmlLayout", fullHtmlLayoutSource);
var fullTextLayoutSource = await ReadSourceAsync("Layouts.Full.text");
Handlebars.RegisterTemplate("FullTextLayout", fullTextLayoutSource);
var titleContactUsHtmlLayoutSource = await ReadSourceAsync("Layouts.TitleContactUs.html");
Handlebars.RegisterTemplate("TitleContactUsHtmlLayout", titleContactUsHtmlLayoutSource);
var titleContactUsTextLayoutSource = await ReadSourceAsync("Layouts.TitleContactUs.text");
Handlebars.RegisterTemplate("TitleContactUsTextLayout", titleContactUsTextLayoutSource);
Handlebars.RegisterHelper("date", (writer, context, parameters) =>
{