Copied to clipboard

Flag this post as spam?

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

  • Iain Martin 54 posts 98 karma points
    Jun 30, 2022 @ 10:24
    Iain Martin


    Using Umbraco V10.

    I'm trying to implement a user change password function in an API Controller and getting stuck on what Service or Interface I need to get this to work.

    I can create the user okay using MemberIdentityUser and the IdentityResult to save the user + password.

    But, I can't seem to find a way to update the password using either of these methods, or in IMemberService or IMemberManager. We used to be able to do it using MemberHelper (I think) but that doesn't exist now, or is not the best way to do things.

    I can see you can change the password using IMemberManager.ChangePasswordAsync() but that needs the MemberIdentityUser as well as the current password to change to the new password, so how do I get that information, if at all.

    Can someone point me in roughly the right direction as to how I can change the password in code - I don't need step by step, just a rough pointer as I do prefer to try and figure stuff out rather than being spoon fed the information.


  • Iain Martin 54 posts 98 karma points
    Jun 30, 2022 @ 10:47
    Iain Martin

    As per ... two minutes later I find the answer.

    Slightly convoluted, but once you've got the drift it's quite easy.

    For anyone else having the same trouble:

     if (FoundMember != null)
                if (data.Password == data.PasswordConfirm)
                    var memIdentity = await _memManager.FindByEmailAsync(FoundMember.Email);
                    var token = await _memManager.GeneratePasswordResetTokenAsync(ii);
                    var result = await _memManager.ChangePasswordWithResetAsync(FoundMember.Id.ToString(), token, data.Password);

    Feel free to 'tidy' this up - I was writing it as I found answers....

Please Sign in or register to post replies

Write your reply to: