chadtmiller.com/group-host
atmosphere group host
0
0
The console switches between accounts signed in in one browser
Merged Approved
This adds multi-account sign-in to the console. A second signed cookie, group_host_accounts, holds up to four other sessions. POST /console/switch swaps one in. Sign-out signs out only the account in use and continues as the next one. getViewer gains an optional accounts, and the user menu and just look --as a,b are updated to match.
I read the whole diff and found nothing that must change.
- Session checks: each held cookie goes through the same
session_ofcheck as the main one, so the HMAC, the expiry and the refusal of cookies signed before a sign-out all apply./console/switchonly moves to a cookie that passes that check, andback_tostill limits where it redirects. - Sign-out:
console_othersruns aftersign_outand excludes the signed-out account. A signed-out account's cookie can't come back through the accounts cookie, and the test covers this. - CSRF: the cookies are
SameSite=Lax, so a cross-site POST to/console/switchcarries no session. It carries the same exposure as/console/logout. - Docs and lexicon:
docs/reference/api.md,docs/development.md, the ui skill and the lexicon description are all updated. - Checks: all checks pass on the head commit, including
testwith its coverage gate,e2e,web,lexiconsanddocs.
The page-reloading switch form goes against the console's use:enhance rule, but you name it under Shortcomings and a switch changes who is signed in, so I'm not asking for a change.
Merged as 8690677
What changes
A browser stays signed in to several accounts. Signing in to the console as another account keeps the one before beside it, in a second cookie (
group_host_accounts) of the same signed session cookies, the one used last first, up to four.POST /console/switch(did,back) swaps one of them in with no sign-in and goes back to the page it was asked from; it switches only to an account the browser still holds. Signing out signs out the account in use alone, refusing every cookie signed for it before, and goes on as the one used before it, or as no one.fyi.opensocial.getViewerlists them, in a new optionalaccounts(actorViews), absent when there are none.The header's menu lists those accounts first, under "Switch account", each its picture and whole handle (the menu as wide as the longest, wrapping only past the screen's edge), switched to in a click; then "Add account", which opens the sign-in dialog (now on every page, signed in or not), above the menu as it was. With other accounts held, "Sign out" reads "Sign out of this account", as it signs out only that one.
just look --as bob,alicesigns in to each in turn, adding each after the first from the menu, the last in use, so a look can draw the switcher.Why
Asked for: an account switcher in the user menu, as knotless has. It is knotless's design: the host already signs its session cookies and refuses those signed before a sign-out, so keeping the others is a cookie of those, checked the same way, and nothing is stored on the host.
How it was checked
switches_between_accounts_signed_in_in_one_browserintests/console_login.rs: one account offers none; a second keeps the first; signing in to one again keeps it once; signing in to one already beside makes it the one in use; switching swaps them and goes back, never elsewhere; switching to an account the browser does not hold is refused; three in order of use; signing out goes on as the one before and leaves the signed-out one switchable from no cookie; down to no one. Clippy,just lex, the layers, dialogs and svelte-check pass here. Tried by hand injust dev. The pictures are the menu signed in to alice alone, and to alice with bob and the longest handle beside her, on desktop light and phone dark. A fresh critique of them asked for the label, the whole handle, and a sign-out that says which; all three are in. It also noted the small avatars' initials are low in contrast in the dark, which isAvatar's everywhere and left as it is.Shortcomings
A plain post: switching reloads the page it was on, as signing out does. The other accounts' pictures are their initials, as the menu's own is.
🤖 Generated with Claude Code