Improving the settings message behavior

This commit is contained in:
Sebastien Ros
2013-11-08 15:44:59 -08:00
parent 2d927962e4
commit 82025baaef
2 changed files with 13 additions and 5 deletions

View File

@@ -15,13 +15,19 @@ namespace Orchard.SecureSocketsLayer.Filters {
_orchardServices = orchardServices;
}
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) {
var settings = _sslService.GetSettings();
if (!settings.Enabled) {
_orchardServices.Notifier.Warning(T("You need to configure the SSL settings."));
return;
}

View File

@@ -47,6 +47,11 @@ namespace Orchard.SecureSocketsLayer.Services {
var actionName = (string) requestContext.RouteData.Values["action"];
if (actionName == null) return false;
var settings = GetSettings();
if (settings == null || !settings.Enabled) {
return false;
}
if (actionName.EndsWith("Ssl") || controllerName.EndsWith("Ssl")) {
return true;
}
@@ -74,9 +79,6 @@ namespace Orchard.SecureSocketsLayer.Services {
}
}
var settings = GetSettings();
if (settings == null) return false;
if (settings.SecureEverything) return true;
if (controllerName == "Account" &&