Skip to content

The login next and returnTo parameters are both set and both read #1993

Closed

Description

@yusuftomilola

Problem

middleware.ts sets loginUrl.searchParams.set("next", pathname) and returnTo, while AuthForm reads returnTo ?? next and RequireAdmin sets only returnTo. Two names for one concept lead to inconsistent redirects (for example, query strings are preserved by buildReturnTo but not by middleware).

Proposed change

Use only returnTo (full path plus query, validated by getSafeReturnTo), remove next, and add one shared helper used by middleware, RequireAdmin and the auth form.

Acceptance criteria

  • Redirecting from /payments/abc?x=1 returns to the same URL after login.
  • next is no longer produced anywhere.

Activity

  1. maixuancanh commented on Oct 17, 2026

    @maixuancanh

    @maixuancanh has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I'll consolidate login redirects around returnTo and a shared helper, preserving the full path and query string. I'll keep getSafeReturnTo validation in place and add tests for middleware, RequireAdmin, and the auth form, including external redirect attempts and /payments/abc?x=1.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @maixuancanh to this issue.

  2. ObedChibunna commented on Oct 17, 2026

    @ObedChibunna
    Contributor

    @ObedChibunna has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I will love to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @ObedChibunna to this issue.

  3. drips-wave commented on Oct 18, 2026

    @drips-wave

    Congratulations, @ObedChibunna! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @ObedChibunna: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  4. added a commit that references this issue on Oct 18, 2026
    be45dea
  5. grantfox-oss commented on Oct 20, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @ObedChibunna's PR #2059 was approved and merged by @yusuftomilola.

    🏆 @ObedChibunna: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (497 total points). Track your full progress on GrantFox.

    👏 Great work, @ObedChibunna! Keep contributing to DistinctCodes.

  6. drips-wave commented on Oct 20, 2026

    @drips-wave

    This issue has been completed by @ObedChibunna as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @ObedChibunna: You earned 150 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions