Validate Password Reset Token
# help-with-umbraco
a
I am trying to hook up the
_memberManager.VerifyUserTokenAsync()
method to validate the password reset token which is generated by
_memberManager.GeneratePasswordResetTokenAsync(member)
The only part I cannot figure out is how to get the
PasswordResetTokenProvider
Can someone shed some light? Thanks!
s
Internally we use "Default"
var result = await _userManager.VerifyUserTokenAsync(user, "Default", "ResetPassword", resetCode);
But that's for backoffice, can't find any usage for members.
a
Awesome that worked 😁 Thanks!
s
lol! well, colour me surprised! 😂
m
result = await _memberManager.VerifyUserTokenAsync(member!, _identityOptions.Tokens.PasswordResetTokenProvider, UserManager<MemberIdentityUser>.ResetPasswordTokenPurpose, token!))
memberManager and userManager both have the same base..
public interface IMemberManager : IUmbracoUserManager<MemberIdentityUser>
and you can remove the magic strings.. injecting
private readonly IdentityOptions _identityOptions;
I think there are a few issues raised around member and user sharing the same Identity configs.. so probably why either VerifyUserTokenAsync works.
I did come across another one with recently also implementing the suite of member pwd stufff.. in that changePassword if you supply an in correct current password, you get a misleading message. "The confirmed password doesn't match the new password!" https://github.com/umbraco/Umbraco-CMS/issues/14528
31 Views