63 lines
2.6 KiB
Plaintext
63 lines
2.6 KiB
Plaintext
@using Umbraco.Core.Security
|
|
@using Umbraco.Extensions
|
|
@using Umbraco.Web.Website.Controllers
|
|
@inherits Umbraco.Web.Common.Macros.PartialViewMacroPage
|
|
@inject IUmbracoWebsiteSecurityAccessor UmbracoWebsiteSecurityAccessor
|
|
|
|
@{
|
|
var websiteSecurity = UmbracoWebsiteSecurityAccessor.WebsiteSecurity;
|
|
var profileModel = await websiteSecurity.GetCurrentMemberProfileModelAsync();
|
|
|
|
|
|
var success = TempData["ProfileUpdateSuccess"] != null;
|
|
}
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"></script>
|
|
|
|
@if (websiteSecurity.IsLoggedIn() && profileModel != null)
|
|
{
|
|
if (success)
|
|
{
|
|
@* This message will show if profileModel.RedirectUrl is not defined (default) *@
|
|
<p>Profile updated</p>
|
|
}
|
|
|
|
using (Html.BeginUmbracoForm<UmbProfileController>("HandleUpdateProfile"))
|
|
{
|
|
<fieldset>
|
|
<legend>Edit profile</legend>
|
|
|
|
@Html.ValidationSummary("profileModel", true)
|
|
|
|
@Html.LabelFor(m => profileModel.Name)
|
|
@Html.TextBoxFor(m => profileModel.Name)
|
|
@Html.ValidationMessageFor(m => profileModel.Name)
|
|
<br />
|
|
|
|
@Html.LabelFor(m => profileModel.Email)
|
|
@Html.TextBoxFor(m => profileModel.Email)
|
|
@Html.ValidationMessageFor(m => profileModel.Email)
|
|
<br />
|
|
|
|
@for (var i = 0; i < profileModel.MemberProperties.Count; i++)
|
|
{
|
|
@Html.LabelFor(m => profileModel.MemberProperties[i].Value, profileModel.MemberProperties[i].Name)
|
|
@*
|
|
By default this will render a textbox but if you want to change the editor template for this property you can
|
|
easily change it. For example, if you wanted to render a custom editor for this field called "MyEditor" you would
|
|
create a file at ~/Views/Shared/EditorTemplates/MyEditor.cshtml", then you will change the next line of code to
|
|
render your specific editor template like:
|
|
@Html.EditorFor(m => profileModel.MemberProperties[i].Value, "MyEditor")
|
|
*@
|
|
@Html.EditorFor(m => profileModel.MemberProperties[i].Value)
|
|
@Html.HiddenFor(m => profileModel.MemberProperties[i].Alias)
|
|
<br />
|
|
}
|
|
|
|
<button>Save</button>
|
|
</fieldset>
|
|
}
|
|
}
|