Files
Umbraco-CMS/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/LoginStatus.cshtml

44 lines
1.3 KiB
Plaintext

@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using System.Web.Mvc.Html
@using ClientDependency.Core.Mvc
@using Umbraco.Web
@using Umbraco.Web.Models
@using Umbraco.Web.Controllers
@{
var loginStatusModel = Members.GetCurrentLoginStatus();
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
Html.RequiresJs("/umbraco_client/ui/jquery.js");
Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js");
Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js");
var logoutModel = new PostRedirectModel();
/*
* Here you can specify a redirect URL for after logging out, by default umbraco will simply
* redirect to the current page. Example to redirect to the home page:
*
* logoutModel.RedirectUrl = "/";
*
*/
}
@*NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed*@
@Html.RenderJsHere()
@if (loginStatusModel.IsLoggedIn)
{
<p>You are currently logged in as @loginStatusModel.Name</p>
using (Html.BeginUmbracoForm<UmbLoginStatusController>("HandleLogout"))
{
<fieldset>
<legend>Logout</legend>
<button>Logout</button>
</fieldset>
@Html.HiddenFor(m => logoutModel.RedirectUrl)
}
}