Commit feb529a
committed
fix: use raw paths for reset/register route definitions in
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#1151sign_in_route
1 parent 6a10e69 commit feb529a
2 files changed
Lines changed: 25 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
354 | 361 | | |
355 | 362 | | |
356 | 363 | | |
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
360 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
361 | 375 | | |
362 | 376 | | |
363 | 377 | | |
| |||
396 | 410 | | |
397 | 411 | | |
398 | 412 | | |
399 | | - | |
| 413 | + | |
400 | 414 | | |
401 | 415 | | |
402 | 416 | | |
403 | | - | |
| 417 | + | |
404 | 418 | | |
405 | 419 | | |
406 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
0 commit comments