I've got a custom surface controller to handle membership. I've got an update member action as follows:
[HttpPost]
[ActionName("MvcMemberUpdate")]
public ActionResult MvcMemberUpdateForm(MvcMemberUpdateModel model)
{
var memberService = Services.MemberService;
var member = memberService.GetByEmail(model.Email);
member.SetValue("firstname", model.FirstName);
member.SetValue("lastname", model.LastName);
memberService.Save(member);
TempData["Success"] = true;
return RedirectToCurrentUmbracoPage();
}
I also want to let the member update their email address (which I also want to be the same as their username.) What is (are) the alias of these properties?
e.g. member.SetValue("email", model.Email);
Can the MemberService be used to achieve what I want it to?
Updating a member email & login
Hi,
I've got a custom surface controller to handle membership. I've got an update member action as follows:
I also want to let the member update their email address (which I also want to be the same as their username.) What is (are) the alias of these properties?
e.g. member.SetValue("email", model.Email);
Can the MemberService be used to achieve what I want it to?
Cheers, Henry
I believe it's as simple as this:
I found a slight issue with updating the currently logged in member this way.
Generally, it does not work Umbraco Public access.
Further, methods like
Umbraco.MembershipHelper.GetCurrentMember()
return null.I believe this is because the current member cookie has an email attached to it, but this is not updated when you update the member.
I recommend logging out the user after they have changed their username so that they can login again.
is working on a reply...