#20230: Fix SSL when custom pages are not matched

Work Item: 20230
This commit is contained in:
Sebastien Ros
2014-03-14 17:36:56 -07:00
parent 252c80f0b7
commit 4bed5c1a9a
3 changed files with 17 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.FieldStorage.InfosetStorage;
@@ -45,11 +46,13 @@ namespace Orchard.SecureSocketsLayer.Models {
set { this.As<InfosetPart>().Set<SslSettingsPart>("CustomEnabled", value.ToString()); }
}
[Required]
public string SecureHostName {
get { return this.As<InfosetPart>().Get<SslSettingsPart>("SecureHostName"); }
set { this.As<InfosetPart>().Set<SslSettingsPart>("SecureHostName", value); }
}
[Required]
public string InsecureHostName {
get { return this.As<InfosetPart>().Get<SslSettingsPart>("InsecureHostName"); }
set { this.As<InfosetPart>().Set<SslSettingsPart>("InsecureHostName", value); }

View File

@@ -99,6 +99,10 @@ namespace Orchard.SecureSocketsLayer.Services {
var urlHelper = new UrlHelper(requestContext);
var url = urlHelper.Action(actionName, controllerName, requestContext.RouteData);
if (String.IsNullOrWhiteSpace(url)) {
return false;
}
return IsRequestProtected(
url, requestContext.HttpContext.Request.ApplicationPath, settings);
}

View File

@@ -8,6 +8,16 @@
@Html.ValidationMessage("Enabled", "*")
</div>
<div data-controllerid="@Html.FieldIdFor(m => m.Enabled)">
<div>
<label for="@Html.FieldIdFor(m => m.SecureHostName)">@T("Secure Host Name")</label>
@Html.TextBoxFor(m => m.SecureHostName, new { @class = "textMedium" })
<span class="hint">@T("(Mandatory) The host name secured traffic should be redirected to (e.g. localhost:44300, secure.mydomain.com). Don't include the protocol or anything else than the host name. A port can be specified after a colon if necessary (e.g. secure.127-0-0-1.org.uk:4333).")</span>
</div>
<div>
<label for="@Html.FieldIdFor(m => m.InsecureHostName)">@T("Insecure Host Name")</label>
@Html.TextBoxFor(m => m.InsecureHostName, new { @class = "textMedium" })
<span class="hint">@T("(Mandatory) The host name non-secured traffic should be redirected to (e.g. localhost:30321, mydomain.com). Don't include the protocol or anything else than the host name. A port can be specified after a colon if necessary (e.g. dev.127-0-0-1.org.uk:4333).")</span>
</div>
<div>
@Html.EditorFor(m => m.SecureEverything)
<label for="@Html.FieldIdFor(m => m.SecureEverything)" class="forcheckbox">@T("Force SSL on all pages")</label>
@@ -29,16 +39,6 @@
</div>
</div>
</div>
<div>
<label for="@Html.FieldIdFor(m => m.SecureHostName)">@T("Secure Host Name")</label>
@Html.TextBoxFor(m => m.SecureHostName, new { @class = "textMedium" })
<span class="hint">@T("Provide the host name secure traffic should be redirected to (e.g. secure.mydomain.com). Don't include the protocol or anything else than the host name. A port can be specified after a colon if necessary (e.g. secure.127-0-0-1.org.uk:4333).")</span>
</div>
<div>
<label for="@Html.FieldIdFor(m => m.InsecureHostName)">@T("Insecure Host Name")</label>
@Html.TextBoxFor(m => m.InsecureHostName, new { @class = "textMedium" })
<span class="hint">@T("Provide the host name non-secured traffic should be redirected to (e.g. mydomain.com). Don't include the protocol or anything else than the host name. A port can be specified after a colon if necessary (e.g. dev.127-0-0-1.org.uk:4333).")</span>
</div>
</div>
</fieldset>