mirror of
https://github.com/bitwarden/server.git
synced 2025-04-15 10:08:14 -05:00
mail templates for RazorViewMailService
This commit is contained in:
parent
0ee863c1d0
commit
9f9150d47e
@ -14,11 +14,24 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="MailTemplates\ChangeEmailAlreadyExists.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\ChangeEmailAlreadyExists.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserInvited.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserInvited.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserAccepted.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserAccepted.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserConfirmed.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\OrganizationUserConfirmed.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\MasterPasswordHint.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\ChangeEmail.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\ChangeEmail.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\NoMasterPasswordHint.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\NoMasterPasswordHint.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\MasterPasswordHint.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\Welcome.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\Welcome.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\_MailLayout.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\_MailLayout.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\_BasicMailLayout.text.cshtml" />
|
||||
<EmbeddedResource Include="MailTemplates\_BasicMailLayout.cshtml" />
|
||||
</ItemGroup>
|
||||
|
7
src/Core/MailTemplates/ChangeEmail.cshtml
Normal file
7
src/Core/MailTemplates/ChangeEmail.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
@model Bit.Core.Models.Mail.ChangeEmailViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<p>
|
||||
To finalize changing your email address enter the following code in the pop-up window: @Model.Token
|
||||
</p>
|
6
src/Core/MailTemplates/ChangeEmail.text.cshtml
Normal file
6
src/Core/MailTemplates/ChangeEmail.text.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@model Bit.Core.Models.Mail.ChangeEmailViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
To finalize changing your email address enter the
|
||||
following code in the pop-up window: @Model.Token
|
11
src/Core/MailTemplates/ChangeEmailAlreadyExists.cshtml
Normal file
11
src/Core/MailTemplates/ChangeEmailAlreadyExists.cshtml
Normal file
@ -0,0 +1,11 @@
|
||||
@model Bit.Core.Models.Mail.ChangeEmailExistsViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<p>
|
||||
A user (@Model.FromEmail) recently tried to change their account to use this
|
||||
email address (@Model.ToEmail). An account already exists with this email (@Model.ToEmail).
|
||||
</p>
|
||||
<p>
|
||||
If you did not try to change an email address, you can safely ignore this email.
|
||||
</p>
|
12
src/Core/MailTemplates/ChangeEmailAlreadyExists.text.cshtml
Normal file
12
src/Core/MailTemplates/ChangeEmailAlreadyExists.text.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@model Bit.Core.Models.Mail.ChangeEmailExistsViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
A user ({{fromEmail}}) recently tried to
|
||||
change their account to use this email
|
||||
address ({{toEmail}}). An account already
|
||||
exists with this email ({{toEmail}}).
|
||||
|
||||
If you did not try to change an email
|
||||
address, you can safely ignore this
|
||||
email.
|
@ -2,10 +2,12 @@
|
||||
@{
|
||||
Layout = "_BasicMailLayout.text";
|
||||
}
|
||||
You (or someone) recently requested your master password hint.
|
||||
You (or someone) recently requested your master
|
||||
password hint.
|
||||
|
||||
Your hint is: "@Model.Hint"
|
||||
|
||||
Login: @Model.WebVaultUrl
|
||||
|
||||
If you did not request your master password hint you can safely ignore this email.
|
||||
If you did not request your master password hint
|
||||
you can safely ignore this email.
|
||||
|
@ -2,6 +2,9 @@
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
You (or someone) recently requested your master password hint. Unfortunately, your account does not have a master password hint.
|
||||
You (or someone) recently requested your
|
||||
master password hint. Unfortunately, your
|
||||
account does not have a master password hint.
|
||||
|
||||
If you did not request your master password hint you can safely ignore this email.
|
||||
If you did not request your master password
|
||||
hint you can safely ignore this email.
|
||||
|
7
src/Core/MailTemplates/OrganizationUserAccepted.cshtml
Normal file
7
src/Core/MailTemplates/OrganizationUserAccepted.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserAcceptedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<p>This email is to notify you that @Model.UserEmail has accepted your invitation to join @Model.OrganizationName.</p>
|
||||
<p>To confirm this user, log into the bitwarden web vault, manage your organization "People, and confirm the user.</p>
|
||||
<p>If you do not wish to confirm this user, you can also remove them from the organization on the same page.</p>
|
15
src/Core/MailTemplates/OrganizationUserAccepted.text.cshtml
Normal file
15
src/Core/MailTemplates/OrganizationUserAccepted.text.cshtml
Normal file
@ -0,0 +1,15 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserConfirmedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout.text";
|
||||
}
|
||||
This email is to notify you that @Model.UserEmail
|
||||
has accepted your invitation to join
|
||||
@Model.OrganizationName.
|
||||
|
||||
To confirm this user, log into the bitwarden
|
||||
web vault, manage your organization "People"
|
||||
and confirm the user.
|
||||
|
||||
If you do not wish to confirm this user,
|
||||
you can also remove them from the
|
||||
organization on the same page.
|
6
src/Core/MailTemplates/OrganizationUserConfirmed.cshtml
Normal file
6
src/Core/MailTemplates/OrganizationUserConfirmed.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserConfirmedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<p>This email is to notify you that you have been confirmed as a user of @(Model.OrganizationName).</p>
|
||||
<p>Any collections and logins being shared with you by this organization will now appear in your bitwarden vault.</p>
|
10
src/Core/MailTemplates/OrganizationUserConfirmed.text.cshtml
Normal file
10
src/Core/MailTemplates/OrganizationUserConfirmed.text.cshtml
Normal file
@ -0,0 +1,10 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserConfirmedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout.text";
|
||||
}
|
||||
This email is to notify you that you have been
|
||||
confirmed as a user of @(Model.OrganizationName).
|
||||
|
||||
Any collections and logins being shared with
|
||||
you by this organization will now appear in
|
||||
your bitwarden vault.
|
13
src/Core/MailTemplates/OrganizationUserInvited.cshtml
Normal file
13
src/Core/MailTemplates/OrganizationUserInvited.cshtml
Normal file
@ -0,0 +1,13 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserInvitedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<p>
|
||||
You have been invited to join the @Model.OrganizationName organization.
|
||||
To accept this invite, click the following link:
|
||||
</p>
|
||||
<p><a href="@Model.Url" target="_blank">@Model.Url</a></p>
|
||||
<p>
|
||||
If you do not wish to join this organization, you can safely ignore
|
||||
this email.
|
||||
</p>
|
14
src/Core/MailTemplates/OrganizationUserInvited.text.cshtml
Normal file
14
src/Core/MailTemplates/OrganizationUserInvited.text.cshtml
Normal file
@ -0,0 +1,14 @@
|
||||
@model Bit.Core.Models.Mail.OrganizationUserInvitedViewModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout.text";
|
||||
}
|
||||
You have been invited to join the
|
||||
@Model.OrganizationName organization.
|
||||
To accept this invite, click the
|
||||
following link:
|
||||
|
||||
@Model.Url
|
||||
|
||||
If you do not wish to join this
|
||||
organization, you can safely ignore
|
||||
this email.
|
@ -1,10 +1,110 @@
|
||||
@model Bit.Core.Models.Mail.BaseMailModel
|
||||
@{
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: 1px solid #e9e9e9; border-radius: 3px; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" bgcolor="white">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-wrap" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 20px;" valign="top">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0 0 10px;" valign="top">
|
||||
Thank you for creating an account with bitwarden. You may now log in with your new account.
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0 0 10px;" valign="top">
|
||||
Did you know that bitwarden is free to sync with all of your devices? Download bitwarden today on:
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="h3" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 25px; margin: 0;" valign="top">
|
||||
Mobile
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0 0 10px;" valign="top">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td valign="middle" class="aligncenter middle" width="50%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center">
|
||||
<a href="https://play.google.com/store/apps/details?id=com.x8bit.bitwarden" title="Get bitwarden on Google Play" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">
|
||||
<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" height="63" width="163" alt="Get bitwarden on Google Play" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</a>
|
||||
</td>
|
||||
<td valign="middle" class="aligncenter middle" width="50%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center">
|
||||
<a href="https://itunes.apple.com/us/app/bitwarden-free-password-manager/id1137397744?mt=8" target="_blank" title="Get bitwarden for iOS" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">
|
||||
<img src="https://bitwarden.com/images/app-store-badge.png" width="135" height="40" alt="Get bitwarden for iOS" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="h3" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 25px; margin: 0;" valign="top">
|
||||
Desktop
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" valign="top">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="aligncenter" width="33%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center" valign="top">Chrome</td>
|
||||
<td class="aligncenter" width="34%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center" valign="top">Firefox</td>
|
||||
<td class="aligncenter" width="33%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center" valign="top">Opera</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0 0 10px;" valign="top">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td valign="middle" class="aligncenter middle" width="33%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center">
|
||||
<a href="https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb?utm_source=welcome_email&utm_medium=email" title="Get bitwarden for Chrome" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">
|
||||
<img width="53" height="54" alt="Chrome Extension" src="https://bitwarden.com/images/chrome.png" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</a>
|
||||
</td>
|
||||
<td valign="middle" class="aligncenter middle" width="34%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center">
|
||||
<a href="https://addons.mozilla.org/firefox/addon/bitwarden-password-manager/" title="Get bitwarden for Firefox" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">
|
||||
<img width="57" height="54" alt="Firefox Extension" src="https://bitwarden.com/images/firefox.png" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</a>
|
||||
</td>
|
||||
<td valign="middle" class="aligncenter middle" width="33%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" align="center">
|
||||
<a href="https://addons.opera.com/extensions/details/bitwarden-free-password-manager/?utm_source=welcome_email&utm_medium=email" title="Get bitwarden for Opera" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">
|
||||
<img width="53" height="54" alt="Opera Extension" src="https://bitwarden.com/images/opera.png" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="h3" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 25px; margin: 0;" valign="top">
|
||||
Web
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" valign="top">
|
||||
You can also access your vault from any web-enabled device using our web vault at:
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block h3 biglink aligncenter" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 25px; margin: 0; padding: 0 0 10px;" align="center" valign="top">
|
||||
<a target="_blank" href="https://vault.bitwarden.com/?utm_source=welcome_email&utm_medium=email" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 20px; line-height: 25px; margin: 0; text-decoration: underline;">vault.bitwarden.com</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0 0 10px;" valign="top">
|
||||
If you have any questions or problems you can email us from our website at <a target="_blank" href="https://bitwarden.com/contact/?utm_source=welcome_email&utm_medium=email" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; text-decoration: underline;">https://bitwarden.com/contact</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content-block last" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 0;" valign="top">
|
||||
Thank you!<br style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;" />
|
||||
The bitwarden Team
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
45
src/Core/MailTemplates/Welcome.text.cshtml
Normal file
45
src/Core/MailTemplates/Welcome.text.cshtml
Normal file
@ -0,0 +1,45 @@
|
||||
@model Bit.Core.Models.Mail.BaseMailModel
|
||||
@{
|
||||
Layout = "_BasicMailLayout";
|
||||
}
|
||||
Thank you for creating an account with bitwarden.
|
||||
You may now log in with your new account.
|
||||
|
||||
Did you know that bitwarden is free to sync with
|
||||
all of your devices? Download bitwarden today on:
|
||||
|
||||
Mobile
|
||||
============
|
||||
|
||||
## iOS
|
||||
https://itunes.apple.com/us/app/bitwarden-free-password-manager/id1137397744?mt=8
|
||||
|
||||
## Android
|
||||
https://play.google.com/store/apps/details?id=com.x8bit.bitwarden
|
||||
|
||||
Desktop
|
||||
============
|
||||
|
||||
## Chrome Extension
|
||||
https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb?utm_source=welcome_email&utm_medium=email
|
||||
|
||||
## Firefox Extension
|
||||
https://addons.mozilla.org/firefox/addon/bitwarden-password-manager/
|
||||
|
||||
## Opera Extension
|
||||
https://addons.opera.com/extensions/details/bitwarden-free-password-manager/?utm_source=welcome_email&utm_medium=email
|
||||
|
||||
Web
|
||||
============
|
||||
|
||||
You can also access your vault from any
|
||||
web-enabled device using our web vault at:
|
||||
@Model.WebVaultUrl/?utm_source=welcome_email&utm_medium=email
|
||||
|
||||
|
||||
If you have any questions or problems you can
|
||||
email us from our website at:
|
||||
https://bitwarden.com/contact/?utm_source=welcome_email&utm_medium=email
|
||||
|
||||
Thank you!
|
||||
The bitwarden Team
|
@ -7,6 +7,6 @@
|
||||
<body>
|
||||
@RenderBody()
|
||||
Regards,<br />
|
||||
The bitwarden team
|
||||
The bitwarden Team
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,3 +1,3 @@
|
||||
@RenderBody()
|
||||
Regards,
|
||||
The bitwarden team
|
||||
The bitwarden Team
|
135
src/Core/MailTemplates/_MailLayout.cshtml
Normal file
135
src/Core/MailTemplates/_MailLayout.cshtml
Normal file
@ -0,0 +1,135 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>bitwarden</title>
|
||||
</head>
|
||||
|
||||
<body style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; height: 100%; line-height: 25px; width: 100% !important;" bgcolor="#f6f6f6">
|
||||
<style type="text/css">
|
||||
body {
|
||||
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;
|
||||
}
|
||||
|
||||
body * {
|
||||
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;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-size-adjust: none;
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
@@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.container-table {
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 0 10px 0 !important;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.invoice {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.main {
|
||||
border-right: none !important;
|
||||
border-left: none !important;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
.logo {
|
||||
padding-top: 10px !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 10px !important;
|
||||
}
|
||||
|
||||
.indented {
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<table class="body-wrap" cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; width: 100%;" bgcolor="#f6f6f6">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td valign="middle" class="aligncenter middle logo" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; padding: 20px 0 10px;" align="center">
|
||||
<img src="https://bitwarden.com/images/logo-gray.png" alt="" width="250" height="39" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="container" align="center" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; clear: both !important; color: #333; display: block !important; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0 auto; max-width: 600px !important; width: 600px;" valign="top">
|
||||
<table cellpadding="0" cellspacing="0" class="container-table" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; clear: both !important; color: #333; display: block !important; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0 auto; max-width: 600px !important; width: 600px;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="content" align="center" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; display: block; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 0; line-height: 0; margin: 0 auto; max-width: 600px; padding-bottom: 20px;" valign="top">
|
||||
|
||||
@RenderBody()
|
||||
|
||||
<table class="footer" cellpadding="0" cellspacing="0" width="100%" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; clear: both; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 15px 0 0; width: 100%;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="aligncenter content-block" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; padding: 0 0 10px;" align="center" valign="top">
|
||||
8bit Solutions LLC
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td class="aligncenter social-icons" align="center" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0;" valign="top">
|
||||
<table cellpadding="0" cellspacing="0" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0 auto;">
|
||||
<tr style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0;">
|
||||
<td style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; padding: 0 10px;" valign="top"><a href="https://twitter.com/bitwarden_app" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; text-decoration: underline;"><img src="https://bitwarden.com/images/mail-twitter.png" alt="Twitter" width="30" height="30" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" /></a></td>
|
||||
<td style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; padding: 0 10px;" valign="top"><a href="https://www.facebook.com/bitwarden/" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; text-decoration: underline;"><img src="https://bitwarden.com/images/mail-facebook.png" alt="Facebook" width="30" height="30" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" /></a></td>
|
||||
<td style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; padding: 0 10px;" valign="top"><a href="https://plus.google.com/114869903467947368993" target="_blank" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; box-sizing: border-box; color: #999; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; text-decoration: underline;"><img src="https://bitwarden.com/images/mail-gplus.png" alt="Google+" width="30" height="30" style="-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; border: none; box-sizing: border-box; color: #333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 25px; margin: 0; max-width: 100%;" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
8
src/Core/MailTemplates/_MailLayout.text.cshtml
Normal file
8
src/Core/MailTemplates/_MailLayout.text.cshtml
Normal file
@ -0,0 +1,8 @@
|
||||
@RenderBody()
|
||||
----------------------------
|
||||
|
||||
8bit Solutions LLC
|
||||
|
||||
- https://twitter.com/bitwarden_app
|
||||
- https://www.facebook.com/bitwarden/
|
||||
- https://plus.google.com/114869903467947368993
|
8
src/Core/Models/Mail/ChangeEmailExistsViewModel.cs
Normal file
8
src/Core/Models/Mail/ChangeEmailExistsViewModel.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
public class ChangeEmailExistsViewModel : BaseMailModel
|
||||
{
|
||||
public string FromEmail { get; set; }
|
||||
public string ToEmail { get; set; }
|
||||
}
|
||||
}
|
7
src/Core/Models/Mail/ChangeEmailViewModel.cs
Normal file
7
src/Core/Models/Mail/ChangeEmailViewModel.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
public class ChangeEmailViewModel : BaseMailModel
|
||||
{
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
public class OrganizationUserAcceptedViewModel : BaseMailModel
|
||||
{
|
||||
public string OrganizationName { get; set; }
|
||||
public string UserEmail { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
public class OrganizationUserConfirmedViewModel : BaseMailModel
|
||||
{
|
||||
public string OrganizationName { get; set; }
|
||||
}
|
||||
}
|
20
src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs
Normal file
20
src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
public class OrganizationUserInvitedViewModel : BaseMailModel
|
||||
{
|
||||
public string OrganizationName { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
public string OrganizationUserId { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string OrganizationNameUrlEncoded { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string Url => string.Format("{0}/accept-organization?organizationId={1}&" +
|
||||
"organizationUserId={2}&email={3}&organizationName={4}&token={5}",
|
||||
WebVaultUrl,
|
||||
OrganizationId,
|
||||
OrganizationUserId,
|
||||
Email,
|
||||
OrganizationNameUrlEncoded,
|
||||
Token);
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Table;
|
||||
using RazorLight;
|
||||
using Bit.Core.Models.Mail;
|
||||
using RazorLight.Templating;
|
||||
using System.IO;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class RazorMailService : IMailService
|
||||
{
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IRazorLightEngine _engine;
|
||||
private readonly IMailDeliveryService _mailDeliveryService;
|
||||
|
||||
public RazorMailService(
|
||||
GlobalSettings globalSettings,
|
||||
IMailDeliveryService mailDeliveryService)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_mailDeliveryService = mailDeliveryService;
|
||||
|
||||
var manager = new CustomEmbeddedResourceTemplateManager("Bit.Core.MailTemplates");
|
||||
var core = new EngineCore(manager, EngineConfiguration.Default);
|
||||
var pageFactory = new DefaultPageFactory(core.KeyCompile);
|
||||
var lookup = new DefaultPageLookup(pageFactory);
|
||||
_engine = new RazorLightEngine(core, lookup);
|
||||
}
|
||||
|
||||
public Task SendChangeEmailAlreadyExistsEmailAsync(string fromEmail, string toEmail)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task SendChangeEmailEmailAsync(string newEmailAddress, string token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task SendMasterPasswordHintEmailAsync(string email, string hint)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Master Password Hint", email);
|
||||
var model = new MasterPasswordHintViewModel
|
||||
{
|
||||
Hint = hint
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("MasterPasswordHint", model);
|
||||
message.TextContent = _engine.Parse("MasterPasswordHint.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendNoMasterPasswordHintEmailAsync(string email)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Master Password Hint", email);
|
||||
var model = new BaseMailModel();
|
||||
message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model);
|
||||
message.TextContent = _engine.Parse("NoMasterPasswordHint.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public Task SendOrganizationAcceptedEmailAsync(string organizationName, string userEmail, IEnumerable<string> adminEmails)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task SendOrganizationConfirmedEmailAsync(string organizationName, string email)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task SendWelcomeEmailAsync(User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private MailMessage CreateDefaultMessage(string subject, string toEmail)
|
||||
{
|
||||
return CreateDefaultMessage(subject, new List<string> { toEmail });
|
||||
}
|
||||
|
||||
private MailMessage CreateDefaultMessage(string subject, IEnumerable<string> toEmails)
|
||||
{
|
||||
var message = new MailMessage
|
||||
{
|
||||
MetaData = new Dictionary<string, object>(),
|
||||
ToEmails = toEmails,
|
||||
Subject = subject
|
||||
};
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public class CustomEmbeddedResourceTemplateManager : ITemplateManager
|
||||
{
|
||||
public CustomEmbeddedResourceTemplateManager(string rootNamespace)
|
||||
{
|
||||
if(rootNamespace == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(rootNamespace));
|
||||
}
|
||||
|
||||
Namespace = rootNamespace;
|
||||
}
|
||||
|
||||
public string Namespace { get; }
|
||||
|
||||
public ITemplateSource Resolve(string key)
|
||||
{
|
||||
var assembly = GetType().Assembly;
|
||||
using(var stream = assembly.GetManifestResourceStream(Namespace + "." + key + ".cshtml"))
|
||||
{
|
||||
if(stream == null)
|
||||
{
|
||||
throw new RazorLightException(string.Format("Couldn't load resource '{0}.{1}.cshtml'.", Namespace, key));
|
||||
}
|
||||
|
||||
using(var reader = new StreamReader(stream))
|
||||
{
|
||||
return new LoadedTemplateSource(reader.ReadToEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
186
src/Core/Services/Implementations/RazorViewMailService.cs
Normal file
186
src/Core/Services/Implementations/RazorViewMailService.cs
Normal file
@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Table;
|
||||
using RazorLight;
|
||||
using Bit.Core.Models.Mail;
|
||||
using RazorLight.Templating;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class RazorViewMailService : IMailService
|
||||
{
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IRazorLightEngine _engine;
|
||||
private readonly IMailDeliveryService _mailDeliveryService;
|
||||
|
||||
public RazorViewMailService(
|
||||
GlobalSettings globalSettings,
|
||||
IMailDeliveryService mailDeliveryService)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_mailDeliveryService = mailDeliveryService;
|
||||
|
||||
var manager = new CustomEmbeddedResourceTemplateManager("Bit.Core.MailTemplates");
|
||||
var core = new EngineCore(manager, EngineConfiguration.Default);
|
||||
var pageFactory = new DefaultPageFactory(core.KeyCompile);
|
||||
var lookup = new DefaultPageLookup(pageFactory);
|
||||
_engine = new RazorLightEngine(core, lookup);
|
||||
}
|
||||
|
||||
public async Task SendChangeEmailAlreadyExistsEmailAsync(string fromEmail, string toEmail)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Email Change", toEmail);
|
||||
var model = new ChangeEmailExistsViewModel
|
||||
{
|
||||
FromEmail = fromEmail,
|
||||
ToEmail = toEmail,
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("ChangeEmailAlreadyExists", model);
|
||||
message.TextContent = _engine.Parse("ChangeEmailAlreadyExists.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendChangeEmailEmailAsync(string newEmailAddress, string token)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Email Change", newEmailAddress);
|
||||
var model = new ChangeEmailViewModel
|
||||
{
|
||||
Token = token,
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("ChangeEmail", model);
|
||||
message.TextContent = _engine.Parse("ChangeEmail.text", model);
|
||||
message.MetaData.Add("SendGridBypassListManagement", true);
|
||||
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendMasterPasswordHintEmailAsync(string email, string hint)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Master Password Hint", email);
|
||||
var model = new MasterPasswordHintViewModel
|
||||
{
|
||||
Hint = hint,
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("MasterPasswordHint", model);
|
||||
message.TextContent = _engine.Parse("MasterPasswordHint.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendNoMasterPasswordHintEmailAsync(string email)
|
||||
{
|
||||
var message = CreateDefaultMessage("Your Master Password Hint", email);
|
||||
var model = new BaseMailModel
|
||||
{
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model);
|
||||
message.TextContent = _engine.Parse("NoMasterPasswordHint.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendOrganizationAcceptedEmailAsync(string organizationName, string userEmail,
|
||||
IEnumerable<string> adminEmails)
|
||||
{
|
||||
var message = CreateDefaultMessage($"User {userEmail} Has Accepted Invite", adminEmails);
|
||||
var model = new OrganizationUserAcceptedViewModel
|
||||
{
|
||||
OrganizationName = organizationName,
|
||||
UserEmail = userEmail,
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("OrganizationUserInvited", model);
|
||||
message.TextContent = _engine.Parse("OrganizationUserInvited.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendOrganizationConfirmedEmailAsync(string organizationName, string email)
|
||||
{
|
||||
var message = CreateDefaultMessage($"You Have Been Confirmed To {organizationName}", email);
|
||||
var model = new OrganizationUserConfirmedViewModel
|
||||
{
|
||||
OrganizationName = organizationName,
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("OrganizationUserConfirmed", model);
|
||||
message.TextContent = _engine.Parse("OrganizationUserConfirmed.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token)
|
||||
{
|
||||
var message = CreateDefaultMessage($"Join {organizationName}", orgUser.Email);
|
||||
var model = new OrganizationUserInvitedViewModel
|
||||
{
|
||||
OrganizationName = organizationName,
|
||||
Email = WebUtility.UrlEncode(orgUser.Email),
|
||||
OrganizationId = orgUser.OrganizationId.ToString(),
|
||||
OrganizationUserId = orgUser.UserId.ToString(),
|
||||
Token = token,
|
||||
OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName),
|
||||
WebVaultUrl = _globalSettings.BaseVaultUri,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
message.HtmlContent = _engine.Parse("OrganizationUserInvited", model);
|
||||
message.TextContent = _engine.Parse("OrganizationUserInvited.text", model);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendWelcomeEmailAsync(User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private MailMessage CreateDefaultMessage(string subject, string toEmail)
|
||||
{
|
||||
return CreateDefaultMessage(subject, new List<string> { toEmail });
|
||||
}
|
||||
|
||||
private MailMessage CreateDefaultMessage(string subject, IEnumerable<string> toEmails)
|
||||
{
|
||||
return new MailMessage
|
||||
{
|
||||
ToEmails = toEmails,
|
||||
Subject = subject
|
||||
};
|
||||
}
|
||||
|
||||
public class CustomEmbeddedResourceTemplateManager : ITemplateManager
|
||||
{
|
||||
public CustomEmbeddedResourceTemplateManager(string rootNamespace)
|
||||
{
|
||||
Namespace = rootNamespace ?? throw new ArgumentNullException(nameof(rootNamespace));
|
||||
}
|
||||
|
||||
public string Namespace { get; }
|
||||
|
||||
public ITemplateSource Resolve(string key)
|
||||
{
|
||||
var assembly = GetType().Assembly;
|
||||
using(var stream = assembly.GetManifestResourceStream(Namespace + "." + key + ".cshtml"))
|
||||
{
|
||||
if(stream == null)
|
||||
{
|
||||
throw new RazorLightException(string.Format("Couldn't load resource '{0}.{1}.cshtml'.", Namespace, key));
|
||||
}
|
||||
|
||||
using(var reader = new StreamReader(stream))
|
||||
{
|
||||
return new LoadedTemplateSource(reader.ReadToEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -36,26 +36,26 @@ namespace Bit.Core.Services
|
||||
|
||||
sendGridMessage.AddTos(message.ToEmails.Select(e => new EmailAddress(e)).ToList());
|
||||
|
||||
if(message.MetaData.ContainsKey("SendGridTemplateId"))
|
||||
if(message.MetaData?.ContainsKey("SendGridTemplateId") ?? false)
|
||||
{
|
||||
sendGridMessage.HtmlContent = " ";
|
||||
sendGridMessage.PlainTextContent = " ";
|
||||
sendGridMessage.TemplateId = message.MetaData["SendGridTemplateId"].ToString();
|
||||
}
|
||||
|
||||
if(message.MetaData.ContainsKey("SendGridSubstitutions"))
|
||||
if(message.MetaData?.ContainsKey("SendGridSubstitutions") ?? false)
|
||||
{
|
||||
var subs = message.MetaData["SendGridSubstitutions"] as Dictionary<string, string>;
|
||||
sendGridMessage.AddSubstitutions(subs);
|
||||
}
|
||||
|
||||
if(message.MetaData.ContainsKey("SendGridCategories"))
|
||||
if(message.MetaData?.ContainsKey("SendGridCategories") ?? false)
|
||||
{
|
||||
var cats = message.MetaData["SendGridCategories"] as List<string>;
|
||||
sendGridMessage.AddCategories(cats);
|
||||
}
|
||||
|
||||
if(message.MetaData.ContainsKey("SendGridBypassListManagement"))
|
||||
if(message.MetaData?.ContainsKey("SendGridBypassListManagement") ?? false)
|
||||
{
|
||||
var bypass = message.MetaData["SendGridBypassListManagement"] as bool?;
|
||||
sendGridMessage.SetBypassListManagement(bypass.GetValueOrDefault(false));
|
||||
|
@ -50,7 +50,7 @@ namespace Bit.Core.Utilities
|
||||
public static void AddDefaultServices(this IServiceCollection services)
|
||||
{
|
||||
//services.AddSingleton<IMailService, SendGridTemplateMailService>();
|
||||
services.AddSingleton<IMailService, RazorMailService>();
|
||||
services.AddSingleton<IMailService, RazorViewMailService>();
|
||||
services.AddSingleton<IMailDeliveryService, SendGridMailDeliveryService>();
|
||||
services.AddSingleton<IPushNotificationService, NotificationHubPushNotificationService>();
|
||||
services.AddSingleton<IBlockIpService, AzureQueueBlockIpService>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user