Update to use constants for emailtype strings
This commit is contained in:
@@ -59,6 +59,15 @@ namespace Umbraco.Cms.Core
|
||||
public const string ActionToken = "action";
|
||||
public const string AreaToken = "area";
|
||||
}
|
||||
|
||||
public static class EmailTypes
|
||||
{
|
||||
public const string HealthCheck = "HealthCheck";
|
||||
public const string Notification = "Notification";
|
||||
public const string PasswordReset = "PasswordReset";
|
||||
public const string TwoFactorAuth = "2FA";
|
||||
public const string UserInvite = "UserInvite";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Umbraco.Cms.Core.HealthChecks.NotificationMethods
|
||||
|
||||
|
||||
var mailMessage = CreateMailMessage(subject, message);
|
||||
await _emailSender.SendAsync(mailMessage, "HealthCheck");
|
||||
await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.HealthCheck);
|
||||
}
|
||||
|
||||
private EmailMessage CreateMailMessage(string subject, string message)
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
_emailSender.SendAsync(request.Mail, "Notification").GetAwaiter().GetResult();
|
||||
_emailSender.SendAsync(request.Mail, Constants.Web.EmailTypes.Notification).GetAwaiter().GetResult();
|
||||
_logger.LogDebug("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
var mailMessage = new EmailMessage(from, user.Email, subject, message, true);
|
||||
|
||||
await _emailSender.SendAsync(mailMessage, "PasswordReset");
|
||||
await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.PasswordReset);
|
||||
|
||||
_userManager.NotifyForgotPasswordRequested(User, user.Id.ToString());
|
||||
}
|
||||
@@ -458,7 +458,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
var mailMessage = new EmailMessage(from, user.Email, subject, message, true);
|
||||
|
||||
await _emailSender.SendAsync(mailMessage, "2FA");
|
||||
await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.TwoFactorAuth);
|
||||
}
|
||||
else if (provider == "Phone")
|
||||
{
|
||||
|
||||
@@ -559,7 +559,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
var mailMessage = new EmailMessage(fromEmail, toMailBoxAddress.ToString(), emailSubject, emailBody, true);
|
||||
|
||||
await _emailSender.SendAsync(mailMessage, "UserInvite", true);
|
||||
await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.UserInvite, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user