mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Fixes #6494
This commit is contained in:
committed by
Sébastien Ros
parent
99b0fd6ca7
commit
8a80daa9b7
@@ -3,7 +3,6 @@ using System.Web.Mvc;
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Mvc.Filters;
|
using Orchard.Mvc.Filters;
|
||||||
using Orchard.SecureSocketsLayer.Services;
|
using Orchard.SecureSocketsLayer.Services;
|
||||||
using Orchard.UI.Notify;
|
|
||||||
|
|
||||||
namespace Orchard.SecureSocketsLayer.Filters {
|
namespace Orchard.SecureSocketsLayer.Filters {
|
||||||
public class SecureSocketsLayersFilter : FilterProvider, IActionFilter {
|
public class SecureSocketsLayersFilter : FilterProvider, IActionFilter {
|
||||||
@@ -17,11 +16,6 @@ namespace Orchard.SecureSocketsLayer.Filters {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
public void OnActionExecuted(ActionExecutedContext filterContext) {
|
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) {
|
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||||
|
|||||||
@@ -116,6 +116,7 @@
|
|||||||
<Compile Include="Filters\SecureSocketsLayersFilter.cs" />
|
<Compile Include="Filters\SecureSocketsLayersFilter.cs" />
|
||||||
<Compile Include="Handlers\SslSettingsPartHandler.cs" />
|
<Compile Include="Handlers\SslSettingsPartHandler.cs" />
|
||||||
<Compile Include="Models\SslSettingsPart.cs" />
|
<Compile Include="Models\SslSettingsPart.cs" />
|
||||||
|
<Compile Include="Services\MissingSettingsBanner.cs" />
|
||||||
<Compile Include="Services\SecureSocketsLayerSettingsProvider.cs" />
|
<Compile Include="Services\SecureSocketsLayerSettingsProvider.cs" />
|
||||||
<Compile Include="Services\ISecureSocketsLayerService.cs" />
|
<Compile Include="Services\ISecureSocketsLayerService.cs" />
|
||||||
<Compile Include="Services\SecureSocketsLayerService.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};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user