diff --git a/src/Orchard.Web/Modules/Orchard.Comments/ViewModels/CommentsCreateViewModel.cs b/src/Orchard.Web/Modules/Orchard.Comments/ViewModels/CommentsCreateViewModel.cs index 9ec57bd49..b6126b973 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/ViewModels/CommentsCreateViewModel.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/ViewModels/CommentsCreateViewModel.cs @@ -5,7 +5,6 @@ namespace Orchard.Comments.ViewModels { public class CommentsCreateViewModel : AdminViewModel { [Required] public string Name { get; set; } - [Required] public string Email { get; set; } public string SiteName { get; set; } public string CommentText { get; set; } diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx b/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx index bcd215698..99fd0f211 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx @@ -1,42 +1,60 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Comments.Models"%> -

<%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%>

<% -if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); } -if (Model.CommentsActive == false) { %> -

<%=_Encoded("Comments have been disabled for this content.") %>

<% -} else { %> - <% using(Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %> - <%=Html.ValidationSummary() %> - <% +<%@ Import Namespace="Orchard.Security" %> +<%@ Import Namespace="Orchard.Comments.Models" %> +

+ <%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%>

+<% + if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); } + if (Model.CommentsActive == false) { %> +

+ <%=_Encoded("Comments have been disabled for this content.") %>

+<% + } + else { %> +<% using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %> +<%=Html.ValidationSummary() %> +<% if (!Request.IsAuthenticated) { %> -
-
- - -
-
- - -
-
- - -
-
<% +
+
+ + +
+
+ + +
+
+ + +
+
+<% + } + else { + var currentUser = Html.Resolve().GetAuthenticatedUser(); +%> + <%=Html.Hidden("Name", currentUser.UserName ?? "")%> + <%=Html.Hidden("Email", currentUser.Email ?? "")%> +<% + }%> +
+
+ + +
+
+ " /> + <%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %> + <%=Html.Hidden("ReturnUrl", Context.Request.Url) %> + <%=Html.AntiForgeryTokenOrchard() %> +
+
+<% + } } %> -
-
- - -
-
- " /> - <%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %> - <%=Html.Hidden("ReturnUrl", Context.Request.Url) %> - <%=Html.AntiForgeryTokenOrchard() %> -
-
<% - } -} %> - - \ No newline at end of file