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) { %> -

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

<% Html.RenderPartial("ListOfComments", Model.Comments); } +

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

+<% 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)) { %> +

<%=_Encoded("Add a Comment") %>

+

<%=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") %>

<% +

<%=_Encoded("Add a Comment") %>

<% if (!Request.IsAuthenticated) { %>
diff --git a/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs b/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs index 5e21b7abe..b2c922b22 100644 --- a/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs +++ b/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs @@ -53,18 +53,17 @@ namespace Orchard.Users.Controllers { _authenticationService.SignIn(user, rememberMe); - if (!String.IsNullOrEmpty(returnUrl)) { - return Redirect(returnUrl); - } - else { - return Redirect("~/"); - } + return !String.IsNullOrEmpty(returnUrl) + ? Redirect(returnUrl) + : Redirect("~/"); } - public ActionResult LogOff() { + public ActionResult LogOff(string returnUrl) { _authenticationService.SignOut(); - return Redirect("~/"); + return !String.IsNullOrEmpty(returnUrl) + ? Redirect(returnUrl) + : Redirect("~/"); } int MinPasswordLength {