1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-14 15:00:49 -05:00
This commit is contained in:
Hinton 2025-06-04 17:39:55 +02:00
parent 390b93f6ce
commit 159d4cc32d
No known key found for this signature in database
GPG Key ID: 5F7295599C5D965C
7 changed files with 108 additions and 2 deletions

View File

@ -0,0 +1,9 @@
using Bit.Core.Platform.Services;
namespace Bit.Core.Auth.UserFeatures.Registration.VerifyEmail;
public class VerifyEmail(string url) : BaseMailModel2
{
public override string Subject { get; set; } = "Verify Your Email";
public string Url { get; } = url;
}

View File

@ -0,0 +1,24 @@
{{#>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" align="center">
Verify this email address for your Bitwarden account by clicking the link below.
</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 last" 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; -webkit-text-size-adjust: none; text-align: left;" valign="top" align="center">
If you did not request to verify a Bitwarden account, you can safely ignore this email.
<br style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;" />
<br style="margin: 0; box-sizing: border-box; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;" />
</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;">
Verify Email Address Now
</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}}

View File

@ -0,0 +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}}}
{{/BasicTextLayout}}

View File

@ -1,4 +1,5 @@
{{#>FullUpdatedHtmlLayout}}

{{#>FullUpdatedHtmlLayout}}
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: #175DDC;padding-top:45px; ">
<tr>
<td align="center" valign="top" width="70%" class="templateColumnContainer">
@ -41,4 +42,4 @@
</td>
</tr>
</table>
{{/FullUpdatedHtmlLayout}}
{{/FullUpdatedHtmlLayout}}

View File

@ -0,0 +1,30 @@
namespace Bit.Core.Platform.Services;
#nullable enable
/// <summary>
/// IMail describes a view model for emails. Any propery in the view model are available for usage
/// in the email templates.
///
/// Each Mail consists of two body parts: a text part and an HTML part and the filename must be
/// relative to the viewmodel and match the following pattern:
/// - `{ClassName}.html.hbs` for the HTML part
/// - `{ClassName}.txt.hbs` for the text part
/// </summary>
public abstract class BaseMailModel2
{
/// <summary>
/// The subject of the email.
/// </summary>
public abstract string Subject { get; set; }
/// <summary>
/// An optional category for processing at the upstream email delivery service.
/// </summary>
public string? Category { get; set; }
/// <summary>
/// Current year.
/// </summary>
public string CurrentYear => DateTime.UtcNow.Year.ToString();
}

View File

@ -0,0 +1,23 @@
namespace Bit.Core.Platform.Services;
#nullable enable
/// <summary>
///
/// </summary>
public interface IMailer
{
/// <summary>
/// Sends an email message to the specified recipient.
/// </summary>
/// <param name="message"></param>
/// <param name="recipient">Recipient email</param>
public void SendEmail(BaseMailModel2 message, string recipient);
/// <summary>
/// Sends multiple emails message to the specified recipients.
/// </summary>
/// <param name="message"></param>
/// <param name="recipients">Recipient emails</param>
public void SendEmails(BaseMailModel2 message, string[] recipients);
}

View File

@ -0,0 +1,11 @@
namespace Bit.Core.Platform.Services;
#nullable enable
public class Mailer : IMailer
{
public void SendEmail(BaseMailModel2 message, string recipient) => throw new NotImplementedException();
public void SendEmails(BaseMailModel2 message, string[] recipients) => throw new NotImplementedException();
}