Monorepo for Tangled tangled.org

state: add account switch/remove endpoints and login flow #944

merged opened by oyster.cafe targeting master from oyster.cafe/tangled-core: master
Labels

None yet.

assignee

None yet.

Participants 3
AT URI
at://did:plc:3fwecdnvtcscjnrx2p4n7alz/sh.tangled.repo.pull/3mc2mfptash22
+2 -4
Interdiff #0 #1
appview/state/accounts.go

This file has not been changed.

appview/state/login.go

This file has not been changed.

+2 -4
appview/state/router.go
··· 132 132 r.Post("/login", s.Login) 133 133 r.Post("/logout", s.Logout) 134 134 135 - r.With(middleware.AuthMiddleware(s.oauth)).Route("/account", func(r chi.Router) { 136 - r.Post("/switch", s.SwitchAccount) 137 - r.Delete("/{did}", s.RemoveAccount) 138 - }) 135 + r.Post("/account/switch", s.SwitchAccount) 136 + r.With(middleware.AuthMiddleware(s.oauth)).Delete("/account/{did}", s.RemoveAccount) 139 137 140 138 r.Route("/repo", func(r chi.Router) { 141 139 r.Route("/new", func(r chi.Router) {

History

3 rounds 7 comments
sign up or login to add to the discussion
1 commit
expand
state: add account switch/remove endpoints and login flow
expand 2 comments

@oppi.li hello the rebase auto-fixed the merge, is that jj working as expected or did I do something wrong

sometimes jj can handle conflicts that git cannot!

pull request successfully merged
1 commit
expand
state: add account switch/remove endpoints and login flow
expand 3 comments

@boltless.me here was the fix line, the new round and my force push makes it hard to see: https://tangled.org/tangled.org/core/pulls/944/round/1#appview%2fstate%2frouter.go-N135

just making the switch endpoint unauthed

interdiffs should be working again, the interdiff of round 1 and 0 highlights the fix quite nicely!

the stack LGTM to me @lewis.moe, could you address the conflicts, happy to merge after! have some very minor UI nits, but we can resolve those down the line.

1 commit
expand
state: add account switch/remove endpoints and login flow
expand 2 comments

Thank you for the contribution! The UI looks pretty good.

From high level, I found some bug when I run this locally.

  1. login with account A, add account B too (works well)
  2. then, logout from account A, back to login page and try switch to B
  3. silently fails and redirected to /login?return_url=%2Flogin.

Account switching after logout shouldn't fail and we should redirect back to /login instead and avoid recursion.

Oh nice catch! Simple fix, though I'm not a jj wizard so it might take a bit for me to figure out how to properly have it show up here. :p

Fix is live on tangled.wizardry.systems at least