The Wayback Machine - https://web.archive.org/web/20220207140342/https://github.com/dotnet/aspnetcore/issues/40032
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

ConfirmEmail.cshtml returnUrl not working #40032

Open
1 task done
MSIH opened this issue Feb 7, 2022 · 0 comments
Open
1 task done

ConfirmEmail.cshtml returnUrl not working #40032

MSIH opened this issue Feb 7, 2022 · 0 comments

Comments

@MSIH
Copy link

@MSIH MSIH commented Feb 7, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

ConfirmEmail.cshtm does not use the returnUrl paramter in the confirmation URL.

Register.cshtml.cs sends an email to confirm the user. The email contains a confirmation link to ConfirmEmail.cshtml. The confirmation link includes three parameters: userId, code, returnUrl

https://FQDN/Identity/Account/ConfirmEmail?userId=12345678-f866-43dd-bbb8-710616122ce2&code=12345678ZFhkV3hmUTVoS3ZqbUhRYXhkQ0lXM0ZYd3BoVWhvKzJYNFZwck5CUUdzVXFWMFlOY2RpTE8vK1pnd25mNkVsQXlobnVteW95UlovMWtSdjBHQzFoTWFpSkdoSFg0OHlTVGhLVXVjMlVib0ZOMXg1bVdzeEZaOFpyWSs1TW5veWw3S21maGNLU1ZrSDRCeEFBaUpWYTdrNWNrcm5VWkRGOGtTQzJMWlJUK1VablhDdDVheGdmMjNtMzJZeVVaTjV0VEZmVCtENWQwdzhia0taNTd2MHRvWTZZMEYwak5wcGZveVZGdFRwSy9ReHJBSTR2YTVLVmVnZmFaMVZ3bi93dz09&returnUrl=%2FProfile

var callbackUrl = Url.Page(
 "/Account/ConfirmEmail", pageHandler: null,
 values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl },
  protocol: Request.Scheme);

 await _emailSender.SendEmailAsync(Input.Email,  "Confirm your email",
  $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

ConfirmEmail.cshtm.cs OnGetAsync signature only is using two parameters:

public async Task<IActionResult> OnGetAsync(string userId, string code)

So the returnUrl is never processed.

Expected Behavior

After users email ti confirmed should be redirected to the return URL.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

6.0.101

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants