diff --git a/src/Orchard.Web/Core/Themes/Views/User.ascx b/src/Orchard.Web/Core/Themes/Views/User.ascx
index 2baa90434..7ae17a794 100644
--- a/src/Orchard.Web/Core/Themes/Views/User.ascx
+++ b/src/Orchard.Web/Core/Themes/Views/User.ascx
@@ -3,7 +3,7 @@
<% if (Request.IsAuthenticated) { %>
<%=T("Welcome,
{0}!", Html.Encode(Page.User.Identity.Name)) %>
- <%=Html.ActionLink(T("Log Off").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users" })%>
+ <%=Html.ActionLink(T("Log Off").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl })%>
| <%= Html.ActionLink("Admin", "Index", new {Area = "Dashboard", Controller = "Admin"})%>
<% } else { %>
<%=Html.ActionLink(T("Log On").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }) %>
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 102e41dec..49d4a3c35 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,17 +1,26 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl
" %>
+<%@ Import Namespace="Orchard.Comments"%>
<%@ Import Namespace="Orchard.Security" %>
-<%@ Import Namespace="Orchard.Comments.Models" %><%
+<%@ Import Namespace="Orchard.Comments.Models" %>
+<%-- todo: clean up this template - waaay too much going on in here :/ --%><%
if (Model.Comments.Count > 0) { %>
-<% Html.RenderPartial("ListOfComments", Model.Comments); }
+
+<% Html.RenderPartial("ListOfComments", Model.Comments);
+}
+
if (Model.CommentsActive == false) {
if (Model.Comments.Count > 0) { %>
<%=_Encoded("Comments have been disabled for this content.") %>
<%
}
}
+else if(!Request.IsAuthenticated && !AuthorizedFor(Permissions.AddComment)) { %>
+
+<%=T("You must {0} to comment.", Html.ActionLink(T("log on").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = string.Format("{0}#addacomment", Context.Request.RawUrl) }))%>
<%
+}
else { %>
<% using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %>
<%=Html.ValidationSummary() %>
- <%=_Encoded("Add a Comment") %>
<%
+ <%
if (!Request.IsAuthenticated) { %>