Monorepo for Tangled

appview/oauth: recover from corrupted session cookies on login

authored by lewis.moe and committed by tangled.org e326cc53 da069e88

+2 -2
+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()