feat: account switcher (#79)
* feat: account switcher
* fix(account-switch): merge redirect query params safely
Parse redirect targets and query_params with net/url, then merge into a single encoded query string to avoid malformed URLs when next already has a query or query_params starts with ?.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* perf(session): avoid duplicate account lookups
Reuse a single session-account fetch path for signin/account/oauth authorize flows by returning both the active repo and account list from one helper.
This removes repeated per-account queries on page render while preserving existing behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(auth): distinguish unauthenticated vs backend session errors
Introduce ErrSessionUnauthenticated and treat only that case as a signin redirect.
Return server errors for account/session lookup failures in account and oauth authorize/revoke flows so backend issues are not masked as re-login prompts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(pr-review): address remaining account/oath review issues
Populate authorize/account template render data for all paths, harden account switch against cross-site POSTs, and apply consistent account session cookie options on save.
Also fix pointer-to-range-variable in session account lookup.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(pr-review): resolve remaining template/session threads
Use explicit .Repo.Did in account switcher templates to avoid ambiguous embedded Did fields in RepoActor.
Reuse the already-loaded session in oauth authorize by adding a helper variant that accepts an existing session instead of re-fetching it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>