Reset password for member
# help-with-umbraco
a
Anyone an idea how I can get an IUser of a member for the following method?
Copy code
csharp
var result = _passwordChanger.ChangePasswordWithIdentityAsync(changePasswordModel, _memberManager).Result;
This will change in V13 and will require a IUser to be added as a third parameter. Or is this method not mend to be for usage to reset frontend members? (Edit: I tried the
var result = _memberManager.ResetPasswordAsync(member, model.ResetKey, model.ConfirmPassword).Result;
route however this has other implications for my usage)
h
I use _memberManager.ChangePasswordWithResetAsync
it requires a user.Id which I get using var user = _memberManager.FindByIdAsync(member.Id.ToString()).Result;
a
That is indeed easier, thanks.
Still needs a token though hah
Have a little issue with 'new member emails' and reset password emails (basically the same thing in my current app), but having a 1 day token expiry on new member mails is a bit.. short
In my old situation I had my own logic for it 🙂
h
you can just generate a token just before the change 😄
a
That sounds horribly wrong, but it'll work 😄
h
I too use my own token, so I validate that and if all ok, generate the token and do the change 😄 The auto generated token is a bit lengthy to pass around in the verify/rest emails.
b
I used
_memberManager.ChangePasswordWithResetAsync()
in a project on Umbraco v10 some time ago, but wanted to add a basic snippet for easy use in core and align it with how user invite works. So this is a draft PR: https://github.com/umbraco/Umbraco-CMS/pull/12991 1. Request a password reset (forgotten password) 2. Actual password reset (change/update password)
48 Views