Monorepo for Tangled tangled.org

appview/oauth: recover from corrupted session cookies on login #1115

merged opened by lewis.moe targeting master from lewis.moe/tangled-core: push-rukyyyptkmtm

Two places in which we error out early instead of just warning and creating cookie anyway.

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:3fwecdnvtcscjnrx2p4n7alz/sh.tangled.repo.pull/3mgcpei64yg22
+2 -2
Diff #0
+1 -1
appview/oauth/accounts.go
··· 63 func (o *OAuth) SaveAccounts(w http.ResponseWriter, r *http.Request, registry *AccountRegistry) error { 64 session, err := o.SessStore.Get(r, AccountsName) 65 if err != nil { 66 - return err 67 } 68 69 data, err := json.Marshal(registry)
··· 63 func (o *OAuth) SaveAccounts(w http.ResponseWriter, r *http.Request, registry *AccountRegistry) error { 64 session, err := o.SessStore.Get(r, AccountsName) 65 if err != nil { 66 + o.Logger.Warn("failed to decode existing accounts cookie, will create new", "err", err) 67 } 68 69 data, err := json.Marshal(registry)
+1 -1
appview/oauth/oauth.go
··· 104 func (o *OAuth) SaveSession(w http.ResponseWriter, r *http.Request, sessData *oauth.ClientSessionData) error { 105 userSession, err := o.SessStore.Get(r, SessionName) 106 if err != nil { 107 - return err 108 } 109 110 userSession.Values[SessionDid] = sessData.AccountDID.String()
··· 104 func (o *OAuth) SaveSession(w http.ResponseWriter, r *http.Request, sessData *oauth.ClientSessionData) error { 105 userSession, err := o.SessStore.Get(r, SessionName) 106 if err != nil { 107 + o.Logger.Warn("failed to decode existing session cookie, will create new", "err", err) 108 } 109 110 userSession.Values[SessionDid] = sessData.AccountDID.String()

History

1 round 0 comments
sign up or login to add to the discussion
lewis.moe submitted #0
1 commit
expand
appview/oauth: recover from corrupted session cookies on login
expand 0 comments
pull request successfully merged