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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user