Files
Umbraco-CMS/src/Umbraco.Web/Controllers/UmbLoginStatusController.cs

39 lines
1.0 KiB
C#
Raw Normal View History

using System.Web.Mvc;
using System.Web.Security;
2013-11-07 17:16:22 +01:00
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Core;
2013-11-07 17:16:22 +01:00
namespace Umbraco.Web.Controllers
{
[MemberAuthorize]
2013-11-07 17:16:22 +01:00
public class UmbLoginStatusController : SurfaceController
{
[HttpPost]
public ActionResult HandleLogout([Bind(Prefix = "logoutModel")]PostRedirectModel model)
2013-11-07 17:16:22 +01:00
{
if (ModelState.IsValid == false)
2013-11-07 17:16:22 +01:00
{
return CurrentUmbracoPage();
}
2013-11-07 17:16:22 +01:00
if (Members.IsLoggedIn())
{
FormsAuthentication.SignOut();
}
TempData["LogoutSuccess"] = true;
//if there is a specified path to redirect to then use it
if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
{
return Redirect(model.RedirectUrl);
2013-11-07 17:16:22 +01:00
}
//redirect to current page by default
2017-07-20 11:21:28 +02:00
return RedirectToCurrentUmbracoPage();
2013-11-07 17:16:22 +01:00
}
}
}