From b19cded4f8a79ac696eee70265fd1c0b1ee18435 Mon Sep 17 00:00:00 2001 From: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> Date: Mon, 20 Jun 2022 09:20:28 -0500 Subject: [PATCH] [PS-721] Left align all email template text (#2033) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make all email template text left-aligned, excluding call-to-actions buttons which should remain centered In the emails needing updates, remove font styling from HTML tags other than and

Add an additional margin above and below each call-to-action button For emails that include only the “ignore” warning below the call-to-action button move the warning up, so the button is the last item displayed Fix the unit test that allows developers to locally generate test emails --- .../EmergencyAccessApproved.html.hbs | 6 +++--- .../EmergencyAccessInvited.html.hbs | 21 +++++++++++-------- .../EmergencyAccessInvited.text.hbs | 5 +++-- .../EmergencyAccessRecovery.html.hbs | 10 ++++----- .../EmergencyAccessRecoveryReminder.html.hbs | 10 ++++----- .../EmergencyAccessRecoveryTimedOut.html.hbs | 6 +++--- .../EmergencyAccessRejected.html.hbs | 6 +++--- ...ForEnterpriseOfferExistingAccount.html.hbs | 13 +++++++----- ...ForEnterpriseOfferExistingAccount.text.hbs | 3 +++ .../OrganizationUserInvited.html.hbs | 21 +++++++++++-------- .../OrganizationUserInvited.text.hbs | 7 ++++--- .../Handlebars/PasswordlessSignIn.html.hbs | 21 +++++++++++-------- .../Handlebars/PasswordlessSignIn.text.hbs | 3 ++- .../Provider/ProviderSetupInvite.html.hbs | 11 ++++++---- .../Provider/ProviderUserInvited.html.hbs | 21 +++++++++++-------- .../Provider/ProviderUserInvited.text.hbs | 5 +++-- .../Handlebars/VerifyDelete.html.hbs | 21 +++++++++++-------- .../Handlebars/VerifyDelete.text.hbs | 3 ++- .../Handlebars/VerifyEmail.html.hbs | 21 +++++++++++-------- .../Handlebars/VerifyEmail.text.hbs | 3 ++- .../Services/HandlebarsMailServiceTests.cs | 3 +++ 21 files changed, 128 insertions(+), 92 deletions(-) diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs index f61412420d..eea5be8291 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs @@ -1,7 +1,7 @@ {{#>FullHtmlLayout}} - - -
+ + + diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs index 585634e3ad..47800dd1ec 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} -
{{Name}} has approved your emergency request. You may now login on the web vault and access their account.
- -
+ + + - + + + + - - -
You have been invited to become an emergency contact for {{Name}}.
+ If you do not wish to become an emergency contact for {{Name}}, you can safely ignore this email. +
+
+
Become emergency contact -
- If you do not wish to become an emergency contact for {{Name}}, you can safely ignore this email. +
diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs index 24ff2d6368..1dfee474ab 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs @@ -1,7 +1,8 @@ {{#>BasicTextLayout}} -You have been invited to become an emergency contact for {{Name}}. To accept this invite, click the following link: +You have been invited to become an emergency contact for {{Name}}. + +If you do not wish to become an emergency contact for {{Name}}, you can safely ignore this email. {{{Url}}} -If you do not wish to become an emergency contact for {{Name}}, you can safely ignore this email. {{/BasicTextLayout}} \ No newline at end of file diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs index 2cfcee9e5e..37abc26dee 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs @@ -1,12 +1,12 @@ {{#>FullHtmlLayout}} - - -
+ + + - - + diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs index f190eb98e6..2bfa1a4a6c 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs @@ -1,12 +1,12 @@ {{#>FullHtmlLayout}} -
{{Name}} has initiated an emergency request to {{Action}} your account. You may login on the web vault and manually approve or reject this request.
+
If you do nothing, the request will be automatically approved after {{DaysLeft}} day(s).
- -
+ + + - - + diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs index cc619df394..d1ad70560e 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs @@ -1,7 +1,7 @@ {{#>FullHtmlLayout}} -
{{Name}} has a pending emergency request to {{Action}} your account. You may login on the web vault and manually approve or reject this request.
+
If you do nothing, the request will be automatically approved after {{DaysLeft}} day(s).
- -
+ + + diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs b/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs index 60a9d79a27..61d95df7d8 100644 --- a/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs +++ b/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs @@ -1,7 +1,7 @@ {{#>FullHtmlLayout}} -
{{Name}} has been granted emergency request to {{Action}} your account. You may login on the web vault and manually revoke this request.
- -
+ + + diff --git a/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.html.hbs b/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.html.hbs index 17f94c1a80..08ecb7c269 100644 --- a/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.html.hbs +++ b/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.html.hbs @@ -5,16 +5,19 @@ A Bitwarden organization, {{SponsorOrgName}}, has sponsored a free Families subscription for you! To activate your complimentary subscription, click the link below. + + + - - -
{{Name}} has rejected your emergency request.
+ If you do not recognize this account, please ignore this message. +
+
+
Accept Offer -
- If you do not recognize this account, please ignore this message. +
diff --git a/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.text.hbs b/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.text.hbs index f457927b2c..b03f955c2a 100644 --- a/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.text.hbs +++ b/src/Core/MailTemplates/Handlebars/FamiliesForEnterprise/FamiliesForEnterpriseOfferExistingAccount.text.hbs @@ -1,5 +1,8 @@ {{#>BasicTextLayout}} A Bitwarden organization, {{SponsorOrgName}}, has sponsored a free Families subscription for you! To activate your complimentary subscription, click the link below. +If you do not recognize this account, please ignore this message. + {{Url}} + {{/BasicTextLayout}} diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs index 99c1ae93ef..01a642a59b 100644 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs +++ b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} - - -
+ + + - + + + + - - -
You have been invited to join the {{OrganizationName}} organization. This link expires on {{ExpirationDate}}.
+ If you do not wish to join this organization, you can safely ignore this email. +
+
+
Join Organization Now -
- If you do not wish to join this organization, you can safely ignore this email. +
diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs index ed0ec4261f..e7f2b9da2c 100644 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs +++ b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs @@ -1,9 +1,10 @@ {{#>BasicTextLayout}} -You have been invited to join the {{OrganizationName}} organization. To accept this invite, click the following link: - -{{{Url}}} +You have been invited to join the {{OrganizationName}} organization. This link expires on {{ExpirationDate}}. If you do not wish to join this organization, you can safely ignore this email. + +{{{Url}}} + {{/BasicTextLayout}} diff --git a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs b/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs index 94fff86f55..c7209d0296 100644 --- a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs +++ b/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} - - -
+ + + - + + + + - - -
Click the following link to log in:
+ If you did not request to log in, you can safely ignore this email. +
+
+
Log In Now -
- If you did not request to log in, you can safely ignore this email. +
diff --git a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs b/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs index e6dea236bd..4fcf2c8faf 100644 --- a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs +++ b/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs @@ -1,7 +1,8 @@ {{#>BasicTextLayout}} Click the following link to log in: +If you did not request to log in, you can safely ignore this email. + {{{Url}}} -If you did not request to log in, you can safely ignore this email. {{/BasicTextLayout}} \ No newline at end of file diff --git a/src/Core/MailTemplates/Handlebars/Provider/ProviderSetupInvite.html.hbs b/src/Core/MailTemplates/Handlebars/Provider/ProviderSetupInvite.html.hbs index eea775e0d4..5146ba97c9 100644 --- a/src/Core/MailTemplates/Handlebars/Provider/ProviderSetupInvite.html.hbs +++ b/src/Core/MailTemplates/Handlebars/Provider/ProviderSetupInvite.html.hbs @@ -1,15 +1,18 @@ {{#>FullHtmlLayout}} - - -
+ + + - +
You have been invited to set up a new Provider within Bitwarden. +
+
Set Up Provider Now +
diff --git a/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.html.hbs b/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.html.hbs index 21ab7848b8..853179dd09 100644 --- a/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.html.hbs +++ b/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} - - -
+ + + - + + + + - - -
You have been invited to join the provider, {{ProviderName}}.
+ If you do not wish to join this provider, you can safely ignore this email. +
+
+
Join Provider Now -
- If you do not wish to join this provider, you can safely ignore this email. +
diff --git a/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.text.hbs b/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.text.hbs index 95a3a22ab7..043373e98b 100644 --- a/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.text.hbs +++ b/src/Core/MailTemplates/Handlebars/Provider/ProviderUserInvited.text.hbs @@ -1,7 +1,8 @@ {{#>BasicTextLayout}} -You have been invited to join the provider, {{ProviderName}}. To accept this invite, click the following link: +You have been invited to join the provider, {{ProviderName}}. + +If you do not wish to join this provider, you can safely ignore this email. {{{Url}}} -If you do not wish to join this provider, you can safely ignore this email. {{/BasicTextLayout}} \ No newline at end of file diff --git a/src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs b/src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs index 8320531d40..e072c426b0 100644 --- a/src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs +++ b/src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} - - -
+ + + - + + + + - - -
Click the link below to delete your Bitwarden account.
+ If you did not request this email to delete your Bitwarden account, you can safely ignore it. +
+
+
Delete Your Account -
- If you did not request this email to delete your Bitwarden account, you can safely ignore it. +
diff --git a/src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs b/src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs index 959cafeba1..5db32bd6b7 100644 --- a/src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs +++ b/src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs @@ -1,7 +1,8 @@ {{#>BasicTextLayout}} Click the link below to delete your Bitwarden account ({{Email}}). +If you did not request this email to delete your Bitwarden account, you can safely ignore it. + {{{Url}}} -If you did not request this email to delete your Bitwarden account, you can safely ignore it. {{/BasicTextLayout}} \ No newline at end of file diff --git a/src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs b/src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs index b633b2215c..85a927aee0 100644 --- a/src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs +++ b/src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs @@ -1,20 +1,23 @@ {{#>FullHtmlLayout}} - - -
+ + + - + + + + - - -
Verify this email address for your Bitwarden account by clicking the link below.
+ If you did not request to verify a Bitwarden account, you can safely ignore this email. +
+
+
Verify Email Address Now -
- If you did not request to verify a Bitwarden account, you can safely ignore this email. +
diff --git a/src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs b/src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs index eb14353c3c..1ea6e3320e 100644 --- a/src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs +++ b/src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs @@ -1,7 +1,8 @@ {{#>BasicTextLayout}} Verify this email address for your Bitwarden account by clicking the link below. +If you did not request to verify a Bitwarden account, you can safely ignore this email. + {{{Url}}} -If you did not request to verify a Bitwarden account, you can safely ignore this email. {{/BasicTextLayout}} \ No newline at end of file diff --git a/test/Core.Test/Services/HandlebarsMailServiceTests.cs b/test/Core.Test/Services/HandlebarsMailServiceTests.cs index 1ac17845be..cd8a49f936 100644 --- a/test/Core.Test/Services/HandlebarsMailServiceTests.cs +++ b/test/Core.Test/Services/HandlebarsMailServiceTests.cs @@ -117,6 +117,9 @@ namespace Bit.Core.Test.Services { ("familyOrgName", typeof(string)), "Test Org Name" }, { ("existingAccount", typeof(bool)), true }, { ("sponsorshipEndDate", typeof(DateTime)), DateTime.UtcNow.AddDays(1)}, + { ("sponsorOrgName", typeof(string)), "Sponsor Test Org Name" }, + { ("expirationDate", typeof(DateTime)), DateTime.Now.AddDays(3) }, + { ("utcNow", typeof(DateTime)), DateTime.UtcNow }, }; var globalSettings = new GlobalSettings