fix: use raw paths for reset/register route definitions in sign_in_route#729
Merged
fix: use raw paths for reset/register route definitions in sign_in_route#729
Conversation
…oute` When `sign_in_route` is used inside a Phoenix router `scope`, the reset and register routes were double-nested. For example, inside `scope "/admin"`, a `reset_path: "/reset"` would generate a route at `/admin/admin/reset` instead of `/admin/reset`. The sign-in route itself was unaffected because it used the raw path option (`unquote(path)`) in the `live/4` call, letting the Phoenix scope mechanism add the prefix once. However, `reset_path` and `register_path` were passed through `Phoenix.Router.scoped_path/2` (which adds the scope prefix) and then used directly in `live/4` (which adds the scope prefix again). The fix maintains separate variables: the scoped paths are still used in session data (so the LiveView generates correct links), while the raw paths are used for route definitions. Fixes team-alembic/ash_authentication#1151
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reset_pathandregister_pathroutes whensign_in_routeis used inside a Phoenix routerscopelive/4call, butreset_path/register_pathwere passed throughPhoenix.Router.scoped_path/2(adds scope prefix) and then used inlive/4(adds scope prefix again)*_route_pathvariables holding the raw paths forlive/4route definitions, while keeping the scoped paths in session data for link generationTest plan
sign_in_routes respects the inherited router scopetest verifying that/nested/resetand/nested/registerroutes exist at the correct pathsFixes team-alembic/ash_authentication#1151