I'm making a form for members to update their own profile, and i have everything working except username. I understand that ASP.NET membership doesn't allow this natively, and I'd probably have to force relogin, but it seems that its possible to set this through:
Amazing how posting on the forum can sharpen one's own powers of deduction.
This seems to work, once the umbraco.cms.businesslogic.member namespace is imported:
// set umbraco login Member member = Member.GetCurrentMember(); member.LoginName = varUsername; // from user input member.Save();
...though through the back end, this only changes the members 'login', not the 'name', which is basically OK, but I'd like to know how to change the member name too if possible.
Name of the member can be changed through the .Text property.
On a sidenote, I do have my doubts about setting the login name through the member api... I don't think the member api handles login conflicts, ie, what would happen if someone changes its login name to an already existing login name?? Better perform an extra check and if ok, set the login name as specified...
Changing Member Login Name
Hello,
I'm making a form for members to update their own profile, and i have everything working except username. I understand that ASP.NET membership doesn't allow this natively, and I'd probably have to force relogin, but it seems that its possible to set this through:
umbraco.cms.businesslogic.member.LoginName.set()
Anyone done this? Am I barking up the wrong tree?
- Andrew
Amazing how posting on the forum can sharpen one's own powers of deduction.
This seems to work, once the umbraco.cms.businesslogic.member namespace is imported:
// set umbraco login
Member member = Member.GetCurrentMember();
member.LoginName = varUsername; // from user input
member.Save();
...though through the back end, this only changes the members 'login', not the 'name', which is basically OK, but I'd like to know how to change the member name too if possible.
Name of the member can be changed through the .Text property.
On a sidenote, I do have my doubts about setting the login name through the member api... I don't think the member api handles login conflicts, ie, what would happen if someone changes its login name to an already existing login name?? Better perform an extra check and if ok, set the login name as specified...
Cheers,
/Dirk
That works great, just I do a simple lookup before changing the login or username to ensure there's no conflict.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.