Fix for issue [workitem:16371]

Removing FollowReturnUrl filter because it always gets executed and does not allow actions to return other view or redirect to other locations.
Replacing filter with a Controller extension method called ReturnUrlRedirect which parses the ReturnUrl in the querystring and returns a RedirectFilter action with that Url.
This commit is contained in:
Andrew Ma
2010-04-05 22:36:30 -07:00
parent e41d711242
commit fde6eef6b9
7 changed files with 47 additions and 61 deletions

View File

@@ -7,7 +7,6 @@ using Orchard.Blogs.ViewModels;
using Orchard.ContentManagement;
using Orchard.Localization;
using Orchard.Mvc.AntiForgery;
using Orchard.Mvc.FollowReturnUrl;
using Orchard.Mvc.Results;
using Orchard.UI.Admin;
using Orchard.UI.Notify;
@@ -101,7 +100,7 @@ namespace Orchard.Blogs.Controllers {
return View(model);
}
[HttpPost, ActionName("Edit"), FollowReturnUrl]
[HttpPost, ActionName("Edit")]
public ActionResult EditPOST(string blogSlug, int postId) {
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, T("Couldn't edit blog post")))
return new HttpUnauthorizedResult();

View File

@@ -7,7 +7,6 @@ using JetBrains.Annotations;
using Orchard.Localization;
using Orchard.ContentManagement;
using Orchard.Mvc.AntiForgery;
using Orchard.Mvc.FollowReturnUrl;
using Orchard.Mvc.Results;
using Orchard.Pages.Drivers;
using Orchard.Pages.Models;
@@ -174,7 +173,7 @@ namespace Orchard.Pages.Controllers {
return View(model);
}
[HttpPost, ActionName("Edit"), FollowReturnUrl]
[HttpPost, ActionName("Edit")]
public ActionResult EditPOST(int id) {
var page = _pageService.GetPageOrDraft(id);
if (page == null)

View File

@@ -5,7 +5,7 @@ using System.Security.Principal;
using System.Web.Mvc;
using System.Web.Security;
using Orchard.Logging;
using Orchard.Mvc.FollowReturnUrl;
using Orchard.Mvc.Extensions;
using Orchard.Mvc.ViewModels;
using Orchard.Security;
using Orchard.Users.Services;
@@ -52,7 +52,7 @@ namespace Orchard.Users.Controllers {
return View("LogOn", new LogOnViewModel {Title = "Log On"});
}
[HttpPost, FollowReturnUrl]
[HttpPost]
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings",
Justification = "Needs to take same parameter type as Controller.Redirect()")]
public ActionResult LogOn(string userName, string password, bool rememberMe) {
@@ -63,14 +63,13 @@ namespace Orchard.Users.Controllers {
_authenticationService.SignIn(user, rememberMe);
return Redirect("~/");
return this.ReturnUrlRedirect();
}
[FollowReturnUrl]
public ActionResult LogOff() {
_authenticationService.SignOut();
return Redirect("~/");
return this.ReturnUrlRedirect();
}
int MinPasswordLength {