diff --git a/src/Orchard.Specs/Blogs.feature b/src/Orchard.Specs/Blogs.feature
index 7d2a60a27..cc773d77f 100644
--- a/src/Orchard.Specs/Blogs.feature
+++ b/src/Orchard.Specs/Blogs.feature
@@ -15,18 +15,18 @@ Scenario: I can create a new blog and blog post
| name | value |
| Routable.Title | My Blog |
And I hit "Save"
- And I go to "my-blog"
- Then I should see "
]*>.*?My Blog.*?
"
- When I go to "admin/blogs"
+ And I go to "admin/blogs"
And I follow "My Blog"
- Then I should see "foo"
- When I follow "New Post"
+ And I follow "New Post"
And I fill in
| name | value |
| Routable.Title | My Post |
| Body.Text | Hi there. |
And I hit "Publish Now"
- And I go to "my-blog/my-post"
+ And I go to "my-blog"
+ Then I should see "
]*>.*?My Blog.*?
"
+ And I should see "
]*>.*?My Post.*?
"
+ When I go to "my-blog/my-post"
Then I should see "
]*>.*?My Post.*?
"
And I should see "Hi there."
diff --git a/src/Orchard.Specs/Blogs.feature.cs b/src/Orchard.Specs/Blogs.feature.cs
index 619696117..47fef6b10 100644
--- a/src/Orchard.Specs/Blogs.feature.cs
+++ b/src/Orchard.Specs/Blogs.feature.cs
@@ -93,17 +93,11 @@ this.ScenarioSetup(scenarioInfo);
#line 17
testRunner.And("I hit \"Save\"");
#line 18
- testRunner.And("I go to \"my-blog\"");
+ testRunner.And("I go to \"admin/blogs\"");
#line 19
- testRunner.Then("I should see \"
]*>.*?My Blog.*?
\"");
-#line 20
- testRunner.When("I go to \"admin/blogs\"");
-#line 21
testRunner.And("I follow \"My Blog\"");
-#line 22
- testRunner.Then("I should see \"foo\"");
-#line 23
- testRunner.When("I follow \"New Post\"");
+#line 20
+ testRunner.And("I follow \"New Post\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -114,12 +108,18 @@ this.ScenarioSetup(scenarioInfo);
table2.AddRow(new string[] {
"Body.Text",
"Hi there."});
-#line 24
+#line 21
testRunner.And("I fill in", ((string)(null)), table2);
-#line 28
+#line 25
testRunner.And("I hit \"Publish Now\"");
+#line 26
+ testRunner.And("I go to \"my-blog\"");
+#line 27
+ testRunner.Then("I should see \"
]*>.*?My Blog.*?
\"");
+#line 28
+ testRunner.And("I should see \"
]*>.*?My Post.*?
\"");
#line 29
- testRunner.And("I go to \"my-blog/my-post\"");
+ testRunner.When("I go to \"my-blog/my-post\"");
#line 30
testRunner.Then("I should see \"
]*>.*?My Post.*?
\"");
#line 31
diff --git a/src/Orchard.Specs/Comments.feature b/src/Orchard.Specs/Comments.feature
new file mode 100644
index 000000000..8ac0badd4
--- /dev/null
+++ b/src/Orchard.Specs/Comments.feature
@@ -0,0 +1,44 @@
+Feature: Comments
+ In order to enable simple comment capabilities on my site
+ As an author
+ I want to allow comments to be safely posted on specific content item pages
+
+Scenario: HTML markup in any given comment is encoded
+ Given I have installed Orchard
+ When I go to "admin/blogs/create"
+ And I fill in
+ | name | value |
+ | Routable.Title | My Blog |
+ And I hit "Save"
+ And I go to "admin/blogs"
+ And I follow "My Blog"
+ And I follow "New Post"
+ And I fill in
+ | name | value |
+ | Routable.Title | My Post |
+ | Body.Text | Hi there. |
+ And I hit "Publish Now"
+ And I go to "my-blog/my-post"
+ And I fill in
+ | name | value |
+ | CommentText | This is a link. |
+ And I hit "Submit Comment"
+ And I am redirected
+ # because the ToUrlString extension method breaks in this specific (test) environment, the returnUrl is broken...
+ And I go to "my-blog/my-post"
+ Then I should see "This is<br id="bad-br" />a <a href"
+ And I should not see " "
+ # another workaround because of ToUrlString in this environment
+ When I go to "Users/Account/LogOff"
+ And I am redirected
+ And I go to "my-blog/my-post"
+ And I fill in
+ | name | value |
+ | Name | Some One |
+ | CommentText | This is a link. |
+ And I hit "Submit Comment"
+ And I am redirected
+ # because the ToUrlString extension method breaks in this specific (test) environment, the returnUrl is broken...
+ And I go to "my-blog/my-post"
+ Then I should see "This is<br id="bad-anon-br" />a <a href"
+ And I should not see " "
\ No newline at end of file
diff --git a/src/Orchard.Specs/Comments.feature.cs b/src/Orchard.Specs/Comments.feature.cs
new file mode 100644
index 000000000..d7110fc1b
--- /dev/null
+++ b/src/Orchard.Specs/Comments.feature.cs
@@ -0,0 +1,152 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.4.0.0
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+#region Designer generated code
+namespace Orchard.Specs
+{
+ using TechTalk.SpecFlow;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Comments")]
+ public partial class CommentsFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "Comments.feature"
+#line hidden
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Comments", "In order to enable simple comment capabilities on my site\r\nAs an author\r\nI want t" +
+ "o allow comments to be safely posted on specific content item pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("HTML markup in any given comment is encoded")]
+ public virtual void HTMLMarkupInAnyGivenCommentIsEncoded()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("HTML markup in any given comment is encoded", ((string[])(null)));
+#line 6
+this.ScenarioSetup(scenarioInfo);
+#line 7
+ testRunner.Given("I have installed Orchard");
+#line 8
+ testRunner.When("I go to \"admin/blogs/create\"");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table1.AddRow(new string[] {
+ "Routable.Title",
+ "My Blog"});
+#line 9
+ testRunner.And("I fill in", ((string)(null)), table1);
+#line 12
+ testRunner.And("I hit \"Save\"");
+#line 13
+ testRunner.And("I go to \"admin/blogs\"");
+#line 14
+ testRunner.And("I follow \"My Blog\"");
+#line 15
+ testRunner.And("I follow \"New Post\"");
+#line hidden
+ TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table2.AddRow(new string[] {
+ "Routable.Title",
+ "My Post"});
+ table2.AddRow(new string[] {
+ "Body.Text",
+ "Hi there."});
+#line 16
+ testRunner.And("I fill in", ((string)(null)), table2);
+#line 20
+ testRunner.And("I hit \"Publish Now\"");
+#line 21
+ testRunner.And("I go to \"my-blog/my-post\"");
+#line hidden
+ TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table3.AddRow(new string[] {
+ "CommentText",
+ "This is a link."});
+#line 22
+ testRunner.And("I fill in", ((string)(null)), table3);
+#line 25
+ testRunner.And("I hit \"Submit Comment\"");
+#line 26
+ testRunner.And("I am redirected");
+#line 28
+ testRunner.And("I go to \"my-blog/my-post\"");
+#line 29
+ testRunner.Then("I should see \"This is<br id="bad-br" />a <a href\"");
+#line 30
+ testRunner.And("I should not see \" \"");
+#line 32
+ testRunner.When("I go to \"Users/Account/LogOff\"");
+#line 33
+ testRunner.And("I am redirected");
+#line 34
+ testRunner.And("I go to \"my-blog/my-post\"");
+#line hidden
+ TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table4.AddRow(new string[] {
+ "Name",
+ "Some One"});
+ table4.AddRow(new string[] {
+ "CommentText",
+ "This is a link."});
+#line 35
+ testRunner.And("I fill in", ((string)(null)), table4);
+#line 39
+ testRunner.And("I hit \"Submit Comment\"");
+#line 40
+ testRunner.And("I am redirected");
+#line 42
+ testRunner.And("I go to \"my-blog/my-post\"");
+#line 43
+ testRunner.Then("I should see \"This is<br id="bad-anon-br" />a <a href\"");
+#line 44
+ testRunner.And("I should not see \" \"");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
+#endregion
diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config
index 10d6ff484..b2cbbbd39 100644
--- a/src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config
+++ b/src/Orchard.Specs/Hosting/Orchard.Web/Core/Web.config
@@ -1,6 +1,9 @@
+
+
+
diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config
index dd900f1a0..61a4dd271 100644
--- a/src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config
+++ b/src/Orchard.Specs/Hosting/Orchard.Web/Themes/Web.config
@@ -1,5 +1,8 @@
+
+
+
diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
index 5253812f5..9fbdb6964 100644
--- a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
+++ b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
@@ -15,7 +15,9 @@
-
+
+
+
diff --git a/src/Orchard.Specs/Hosting/RequestExtensions.cs b/src/Orchard.Specs/Hosting/RequestExtensions.cs
index 4a5ba60ce..1cd5d7fd9 100644
--- a/src/Orchard.Specs/Hosting/RequestExtensions.cs
+++ b/src/Orchard.Specs/Hosting/RequestExtensions.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Web;
using System.Web.Hosting;
using Orchard.Specs.Util;
@@ -45,7 +46,28 @@ namespace Orchard.Specs.Hosting {
string setCookie;
if (details.ResponseHeaders.TryGetValue("Set-Cookie", out setCookie)) {
Trace.WriteLine(string.Format("Set-Cookie: {0}", setCookie));
- webHost.Cookies = (webHost.Cookies + ';' + setCookie.Split(';').FirstOrDefault()).Trim(';');
+ var cookieName = setCookie.Split(';')[0].Split('=')[0];
+ DateTime expires;
+ if (!string.IsNullOrEmpty(webHost.Cookies)
+ && setCookie.Contains("expires=")
+ && DateTime.TryParse(setCookie.Split(new[] { "expires=" }, 2, StringSplitOptions.None)[1].Split(';')[0], out expires)
+ && expires < DateTime.Now) {
+ // remove
+ Trace.WriteLine(string.Format("Removing cookie: {0}", cookieName));
+ webHost.Cookies = Regex.Replace(webHost.Cookies, string.Format("{0}=[^;]*;?", cookieName), "");
+ }
+ else if (!string.IsNullOrEmpty(webHost.Cookies)
+ && Regex.IsMatch(webHost.Cookies, string.Format("\b{0}=", cookieName))) {
+ // replace
+ Trace.WriteLine(string.Format("Replacing cookie: {0}", cookieName));
+ webHost.Cookies = Regex.Replace(webHost.Cookies, string.Format("{0}=[^;]*(;?)", cookieName), string.Format("{0}$1", setCookie.Split(';')[0]));
+ }
+ else {
+ // add
+ Trace.WriteLine(string.Format("Adding cookie: {0}", cookieName));
+ webHost.Cookies = (webHost.Cookies + ';' + setCookie.Split(';').FirstOrDefault()).Trim(';');
+ }
+ Trace.WriteLine(string.Format("Cookie jar: {0}", webHost.Cookies));
}
return details;
diff --git a/src/Orchard.Specs/Hosting/Simple.Web/Web.config b/src/Orchard.Specs/Hosting/Simple.Web/Web.config
index 1090760b1..34890f7f7 100644
--- a/src/Orchard.Specs/Hosting/Simple.Web/Web.config
+++ b/src/Orchard.Specs/Hosting/Simple.Web/Web.config
@@ -23,7 +23,9 @@
-
+
+
+
-
+
diff --git a/src/Orchard.Web/Core/Containers/Views/EditorTemplates/Container.cshtml b/src/Orchard.Web/Core/Containers/Views/EditorTemplates/Container.cshtml
index e321e9841..d9cc0c7d2 100644
--- a/src/Orchard.Web/Core/Containers/Views/EditorTemplates/Container.cshtml
+++ b/src/Orchard.Web/Core/Containers/Views/EditorTemplates/Container.cshtml
@@ -6,9 +6,9 @@
@Html.SelectOption(Model.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
- @Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomOne", T("Custom 1").Text)
- @Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomTwo", T("Custom 2").Text)
- @Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomThree", T("Custom 3").Text)
+ @Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
+ @Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
+ @Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.CustomThree", T("Custom 3").Text)