2016-06-13 17:42:05 +02:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-21 13:04:57 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2020-05-25 14:50:51 +02:00
|
|
|
|
using Umbraco.Core.Hosting;
|
2020-01-07 13:08:21 +01:00
|
|
|
|
using Umbraco.Core.IO;
|
2016-06-13 17:42:05 +02:00
|
|
|
|
using Umbraco.Core.Services;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.HealthCheck.Checks.Config
|
|
|
|
|
|
{
|
|
|
|
|
|
[HealthCheck("3E2F7B14-4B41-452B-9A30-E67FBC8E1206", "Notification Email Settings",
|
|
|
|
|
|
Description = "If notifications are used, the 'from' email address should be specified and changed from the default value.",
|
|
|
|
|
|
Group = "Configuration")]
|
|
|
|
|
|
public class NotificationEmailCheck : AbstractConfigCheck
|
|
|
|
|
|
{
|
|
|
|
|
|
private const string DefaultFromEmail = "your@email.here";
|
|
|
|
|
|
|
2020-09-21 13:04:57 +02:00
|
|
|
|
public NotificationEmailCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
|
|
|
|
|
|
: base(textService, hostingEnvironment, loggerFactory)
|
2016-09-01 19:06:08 +02:00
|
|
|
|
{ }
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string FilePath => "~/Config/umbracoSettings.config";
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string XPath => "/settings/content/notifications/email";
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldNotEqual;
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override IEnumerable<AcceptableConfiguration> Values => new List<AcceptableConfiguration>
|
2016-06-13 17:42:05 +02:00
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
|
new AcceptableConfiguration { IsRecommended = false, Value = DefaultFromEmail }
|
|
|
|
|
|
};
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string CheckSuccessMessage => TextService.Localize("healthcheck/notificationEmailsCheckSuccessMessage", new [] { CurrentValue } );
|
|
|
|
|
|
|
|
|
|
|
|
public override string CheckErrorMessage => TextService.Localize("healthcheck/notificationEmailsCheckErrorMessage", new[] { DefaultFromEmail });
|
2016-06-13 17:42:05 +02:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|