Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResetPassword code should be HtmlDecoded #8325

Closed
westonsoftware opened this issue Mar 8, 2019 · 8 comments · Fixed by #12109
Closed

ResetPassword code should be HtmlDecoded #8325

westonsoftware opened this issue Mar 8, 2019 · 8 comments · Fixed by #12109
Assignees
Labels
area-identity Includes: Identity and providers bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@westonsoftware
Copy link

westonsoftware commented Mar 8, 2019

An "invalid token" message is displayed periodically on the ResetPassword page after using the ForgotPassword page to send the user an email, and clicking on that link.

https://github.com/aspnet/AspNetCore/blob/bfec2c14be1e65f7dd361a43950d4c848ad0cd35/src/Identity/UI/src/Areas/Identity/Pages/V3/Account/ResetPassword.cshtml.cs#L120

I believe the fix should be to decode the code like this ...

var decoded = System.Web.HttpUtility.HtmlDecode(Input.Code);
var result = await _userManager.ResetPasswordAsync(user, decoded, Input.Password);

I would do a PR for this but I have never contributed before and I thought someone could squeeze this in.
Thanks
--Andy

@westonsoftware
Copy link
Author

@muratg muratg added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 8, 2019
@Eilon Eilon added the area-identity Includes: Identity and providers label Mar 8, 2019
@mkArtakMSFT mkArtakMSFT removed the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 8, 2019
@blowdart
Copy link
Contributor

I know you say it's intermittent, but do you happen to have an example of such a code?

@westonsoftware
Copy link
Author

Yes, I should have mentioned, keep trying it until your code has a '+' in it, that was happening to me consistently for a while.

@blowdart
Copy link
Contributor

Ah, that would explain it :) + decodes different in forms than in URIs.

@HaoK we have a hint :)

@blowdart blowdart added this to the 3.0.0-preview5 milestone Mar 28, 2019
@HaoK
Copy link
Member

HaoK commented Jul 1, 2019

Didn't notice this one since it wasn't assigned to me, will fix it in preview 8

@HaoK
Copy link
Member

HaoK commented Jul 15, 2019

Fix now url encodes the code before we html encode it so it should be always safe, we also url decode the code before we try to verify them with the user manager as well

@HaoK HaoK added bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed labels Jul 15, 2019
@westonsoftware
Copy link
Author

Thanks! :)

@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-identity Includes: Identity and providers bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants