mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 21:43:27 +08:00
Fixes #6494
This commit is contained in:
parent
99b0fd6ca7
commit
8a80daa9b7
@ -3,7 +3,6 @@ using System.Web.Mvc;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.Filters;
|
||||
using Orchard.SecureSocketsLayer.Services;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.SecureSocketsLayer.Filters {
|
||||
public class SecureSocketsLayersFilter : FilterProvider, IActionFilter {
|
||||
@ -17,11 +16,6 @@ namespace Orchard.SecureSocketsLayer.Filters {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext filterContext) {
|
||||
var settings = _sslService.GetSettings();
|
||||
|
||||
if (!settings.Enabled) {
|
||||
_orchardServices.Notifier.Warning(T("You need to configure the SSL settings."));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||
|
@ -116,6 +116,7 @@
|
||||
<Compile Include="Filters\SecureSocketsLayersFilter.cs" />
|
||||
<Compile Include="Handlers\SslSettingsPartHandler.cs" />
|
||||
<Compile Include="Models\SslSettingsPart.cs" />
|
||||
<Compile Include="Services\MissingSettingsBanner.cs" />
|
||||
<Compile Include="Services\SecureSocketsLayerSettingsProvider.cs" />
|
||||
<Compile Include="Services\ISecureSocketsLayerService.cs" />
|
||||
<Compile Include="Services\SecureSocketsLayerService.cs" />
|
||||
|
@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.SecureSocketsLayer.Services {
|
||||
public class MissingSettingsBanner : INotificationProvider {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly ISecureSocketsLayerService _sslService;
|
||||
|
||||
public MissingSettingsBanner(IOrchardServices orchardServices, ISecureSocketsLayerService sslService) {
|
||||
_orchardServices = orchardServices;
|
||||
_sslService = sslService;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||
var workContext = _orchardServices.WorkContext;
|
||||
var settings = _sslService.GetSettings();
|
||||
|
||||
if (!settings.Enabled) {
|
||||
var urlHelper = new UrlHelper(workContext.HttpContext.Request.RequestContext);
|
||||
var url = urlHelper.Action("Ssl", "Admin", new {Area = "Settings"});
|
||||
yield return new NotifyEntry {Message = T("The <a href=\"{0}\">SSL settings</a> need to be configured.", url), Type = NotifyType.Warning};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user