1
0
mirror of https://github.com/bitwarden/server synced 2025-12-18 01:03:17 +00:00

verify email apis and emails

This commit is contained in:
Kyle Spearrin
2017-07-01 23:20:19 -04:00
parent c8528384f8
commit 97ad8bd943
12 changed files with 111 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ namespace Bit.Core.Services
public class SendGridTemplateMailService : IMailService
{
private const string WelcomeTemplateId = "045f8ad5-5547-4fa2-8d3d-6d46e401164d";
private const string VerifyEmailTemplateId = "TODO";
private const string ChangeEmailAlreadyExistsTemplateId = "b69d2038-6ad9-4cf6-8f7f-7880921cba43";
private const string ChangeEmailTemplateId = "ec2c1471-8292-4f17-b6b6-8223d514f86e";
private const string TwoFactorEmailTemplateId = "264cfe69-5258-4c89-8d90-76b4659de589";
@@ -45,6 +46,21 @@ namespace Bit.Core.Services
await _mailDeliveryService.SendEmailAsync(message);
}
public async Task SendVerifyEmailEmailAsync(string email, Guid userId, string token)
{
var message = CreateDefaultMessage(
"Verify Your Email",
email,
VerifyEmailTemplateId);
AddSubstitution(message, "{{token}}", Uri.EscapeDataString(token));
AddSubstitution(message, "{{userId}}", userId.ToString());
AddCategories(message, new List<string> { AdministrativeCategoryName, "Verify Email" });
message.MetaData.Add("SendGridBypassListManagement", true);
await _mailDeliveryService.SendEmailAsync(message);
}
public async Task SendChangeEmailAlreadyExistsEmailAsync(string fromEmail, string toEmail)
{
var message = CreateDefaultMessage(