Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andrew Waegel 126 posts 126 karma points
    Sep 18, 2010 @ 00:27
    Andrew Waegel
    0

    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

  • Andrew Waegel 126 posts 126 karma points
    Sep 18, 2010 @ 00:57
    Andrew Waegel
    0

    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.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 18, 2010 @ 11:00
    Dirk De Grave
    0

    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

  • Andrew Waegel 126 posts 126 karma points
    Sep 25, 2010 @ 00:34
    Andrew Waegel
    0

    That works great, just I do a simple lookup before changing the login or username to ensure there's no conflict.

  • 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.

Please Sign in or register to post replies