Skip to content

fix: more robust redirects for verification to result page #339

Merged
TTA777 merged 4 commits intomainfrom
fix/verification-page
Nov 29, 2025
Merged

fix: more robust redirects for verification to result page #339
TTA777 merged 4 commits intomainfrom
fix/verification-page

Conversation

@duckth
Copy link
Copy Markdown
Member

@duckth duckth commented Nov 14, 2025

Looks like the verification page has some issues with redirecting to the result page, resulting in being redirected back to the verification page (with the same token), thus displaying the error page. This is an attempt to make the redirect routing a bit more robust, but since it doesn't fail locally it's a bit difficult to test properly 🙃

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the email verification and account deletion flows to use route parameters instead of TempData for passing success/error messages to the Result page. The main motivation is to fix redirect issues where users were being redirected back to the verification page instead of seeing the result.

Key changes:

  • Replaced TempData-based message passing with route parameter-based approach
  • Updated Result.cshtml to accept route parameters ({action?}/{outcome?}) and use pattern matching to determine content
  • Refactored code structure from delegate syntax to local functions for improved readability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
coffeecard/CoffeeCard.WebApi/Pages/VerifyEmail.cshtml.cs Refactored to pass verification results via route parameters instead of TempData; simplified code structure using local function
coffeecard/CoffeeCard.WebApi/Pages/VerifyDelete.cshtml.cs Refactored to pass deletion success via route parameters instead of TempData; simplified code structure using local function
coffeecard/CoffeeCard.WebApi/Pages/Result.cshtml Updated to read action/outcome from route parameters and use pattern matching to display appropriate messages; removed TempData dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread coffeecard/CoffeeCard.WebApi/Pages/VerifyEmail.cshtml.cs Outdated
Comment thread coffeecard/CoffeeCard.WebApi/Pages/Result.cshtml Outdated
Copy link
Copy Markdown
Member

@TTA777 TTA777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good initiative, but as the AI said, you have a problem where you are not accounting for the internals of the pageUtil still using TempData. You also missed the recover page, so that one is likely broken in this pr.

Personally, also not a huge fan of how the outcomes were handled, with there being a couple of "magic strings" per page. I would think an enum could do?

I've tried to address these concerns in #340. Have a look, and you can merge that into this one if you agree, or draw inspiration

@duckth
Copy link
Copy Markdown
Member Author

duckth commented Nov 28, 2025

Good initiative, but as the AI said, you have a problem where you are not accounting for the internals of the pageUtil still using TempData. You also missed the recover page, so that one is likely broken in this pr.

Personally, also not a huge fan of how the outcomes were handled, with there being a couple of "magic strings" per page. I would think an enum could do?

I've tried to address these concerns in #340. Have a look, and you can merge that into this one if you agree, or draw inspiration

Looks good. I agree the original was not optimal. I have merged your changes into this.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread coffeecard/CoffeeCard.WebApi/Pages/Shared/Outcomes.cs Outdated
Comment thread coffeecard/CoffeeCard.WebApi/Pages/Shared/Outcomes.cs Outdated
Comment thread coffeecard/CoffeeCard.WebApi/Helpers/PageUtils.cs Outdated
Comment thread coffeecard/CoffeeCard.WebApi/Pages/Recover.cshtml.cs
Comment thread coffeecard/CoffeeCard.WebApi/Pages/Recover.cshtml.cs
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@f29e187). Learn more about missing BASE report.

Files with missing lines Patch % Lines
coffeecard/CoffeeCard.WebApi/Pages/Result.cshtml 0.00% 15 Missing ⚠️
...feecard/CoffeeCard.WebApi/Pages/Shared/Outcomes.cs 0.00% 13 Missing ⚠️
coffeecard/CoffeeCard.WebApi/Helpers/PageUtils.cs 0.00% 9 Missing ⚠️
...ffeecard/CoffeeCard.WebApi/Pages/Recover.cshtml.cs 0.00% 9 Missing ⚠️
...ard/CoffeeCard.WebApi/Pages/VerifyDelete.cshtml.cs 0.00% 4 Missing ⚠️
...card/CoffeeCard.WebApi/Pages/VerifyEmail.cshtml.cs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #339   +/-   ##
=======================================
  Coverage        ?   13.89%           
=======================================
  Files           ?      239           
  Lines           ?    16956           
  Branches        ?      259           
=======================================
  Hits            ?     2356           
  Misses          ?    14554           
  Partials        ?       46           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TTA777 TTA777 merged commit 72fe9ef into main Nov 29, 2025
4 checks passed
@TTA777 TTA777 deleted the fix/verification-page branch November 29, 2025 11:09
@TTA777 TTA777 linked an issue Nov 29, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upon user verification, the website says the link is invalid

4 participants