You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
affected-very-fewThis issue impacts very few customersarea-identityIncludes: Identity and providersenhancementThis issue represents an ask for new feature or an enhancement to an existing oneseverity-nice-to-haveThis label is used by an internal tool
It doesn't work when trying to change email, because now it uses GetChangeEmailTokenPurpose, which is protected. (Could be other uses cases too, haven't checked.)
And as you can see, it was changed to "ChangeEmail:" + newEmail, so the constant you linked is dead code.
I've opted to subclass instead, to avoid magic strings (as shown by this issue, it's a bad idea to rely on magic strings 😄).
For anyone else migrating code to 2.2, note that if you subclass, it's important not to register the subclass with the container, but to replace the default during init:
services.AddIdentityCore<User>().AddUserManager<MyUserManager<User>>()// <--- the magic
affected-very-fewThis issue impacts very few customersarea-identityIncludes: Identity and providersenhancementThis issue represents an ask for new feature or an enhancement to an existing oneseverity-nice-to-haveThis label is used by an internal tool
Activity
blowdart commentedon Jul 26, 2019
@HaoK another breaking change?
lonix1 commentedon Jul 26, 2019
To be consistent, consider:
Changing
GetChangeEmailTokenPurpose()(and related) topublic.OR, changing
VerifyUserTokenAsync()toprotected, because it becomes useless anyways.HaoK commentedon Jul 26, 2019
No the constants are still there, see: https://github.com/aspnet/AspNetCore/blob/master/src/Identity/Extensions.Core/src/UserManager.cs#L39
lonix1 commentedon Jul 26, 2019
It doesn't work when trying to change email, because now it uses
GetChangeEmailTokenPurpose, which is protected. (Could be other uses cases too, haven't checked.)And as you can see, it was changed to
"ChangeEmail:" + newEmail, so the constant you linked is dead code.It is used here and here.
HaoK commentedon Jul 26, 2019
Ok, that seems safe enough to expose in the future.
So you can just call VerifyUserTokenAsync with "ChangeEmail:" + newEmail as the purpose in the short term.
But there's no breaking change here
HaoK commentedon Jul 26, 2019
Something for the backlog / future @blowdart
lonix1 commentedon Jul 26, 2019
Thanks for looking into this.
I've opted to subclass instead, to avoid magic strings (as shown by this issue, it's a bad idea to rely on magic strings 😄).
For anyone else migrating code to 2.2, note that if you subclass, it's important not to register the subclass with the container, but to replace the default during init:
And then it's as easy as this: