Updates the membership partial view templates to redirect to current page by default but allows this to be overridden. Creates a new RedirectToCurrentUmbracoUrl method which is slightly diff from RedirectToCurrentUmbracoPage since it doesn't care about the actual page item rendering, just the currently rendered URL which is useful if coming from a rewritten URL (which is what happens with public access rewrites)

This commit is contained in:
Shannon
2014-02-13 13:30:32 +11:00
parent 9827b40bea
commit f5ee02a3e9
11 changed files with 110 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ using System.Web.Security;
using umbraco.cms.businesslogic.member;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Core;
namespace Umbraco.Web.Controllers
{
@@ -24,7 +25,16 @@ namespace Umbraco.Web.Controllers
return CurrentUmbracoPage();
}
return Redirect("/");
//if there is a specified path to redirect to then use it
if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
{
return Redirect(model.RedirectUrl);
}
//redirect to current page by default
TempData.Add("LoginSuccess", true);
//return RedirectToCurrentUmbracoPage();
return RedirectToCurrentUmbracoUrl();
}
}
}

View File

@@ -4,13 +4,14 @@ using System.Web.Security;
using umbraco.cms.businesslogic.member;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Core;
namespace Umbraco.Web.Controllers
{
public class UmbLoginStatusController : SurfaceController
{
[HttpPost]
public ActionResult HandleLogout([Bind(Prefix = "loginStatusModel")]LoginStatusModel model)
public ActionResult HandleLogout([Bind(Prefix = "logoutModel")]PostRedirectModel model)
{
if (ModelState.IsValid == false)
{
@@ -22,9 +23,15 @@ namespace Umbraco.Web.Controllers
FormsAuthentication.SignOut();
}
//TODO: Shouldn't we be redirecting to the current page or integrating this with the
// normal Umbraco protection stuff?
return Redirect("/");
//if there is a specified path to redirect to then use it
if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
{
return Redirect(model.RedirectUrl);
}
//redirect to current page by default
TempData.Add("LogoutSuccess", true);
return RedirectToCurrentUmbracoPage();
}
}
}