Monorepo for Tangled tangled.org

appview/oauth: remove AuthReturnInfo #1024

open opened by boltless.me targeting master from sl/uvpzuszrulvq
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3mdcq5ouzet22
+6 -13
Diff #6
+3 -9
appview/oauth/accounts.go
··· 126 126 } 127 127 } 128 128 129 - type AuthReturnInfo struct { 130 - ReturnURL string 131 - } 132 - 133 129 func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string) error { 134 130 session, err := o.SessStore.Get(r, AuthReturnName) 135 131 if err != nil { ··· 145 141 return session.Save(r, w) 146 142 } 147 143 148 - func (o *OAuth) GetAuthReturn(r *http.Request) *AuthReturnInfo { 144 + func (o *OAuth) GetAuthReturn(r *http.Request) string { 149 145 session, err := o.SessStore.Get(r, AuthReturnName) 150 146 if err != nil || session.IsNew { 151 - return &AuthReturnInfo{} 147 + return "" 152 148 } 153 149 154 150 returnURL, _ := session.Values[AuthReturnURL].(string) 155 151 156 - return &AuthReturnInfo{ 157 - ReturnURL: returnURL, 158 - } 152 + return returnURL 159 153 } 160 154 161 155 func (o *OAuth) ClearAuthReturn(w http.ResponseWriter, r *http.Request) error {
+3 -4
appview/oauth/handler.go
··· 63 63 ctx := r.Context() 64 64 l := o.Logger.With("query", r.URL.Query()) 65 65 66 - authReturn := o.GetAuthReturn(r) 66 + redirectURL := o.GetAuthReturn(r) 67 67 _ = o.ClearAuthReturn(w, r) 68 68 69 69 sessData, err := o.ClientApp.ProcessCallback(ctx, r.URL.Query()) ··· 106 106 } 107 107 } 108 108 109 - redirectURL := "/" 110 - if authReturn.ReturnURL != "" { 111 - redirectURL = authReturn.ReturnURL 109 + if redirectURL == "" { 110 + redirectURL = "/" 112 111 } 113 112 114 113 if o.isAccountDeactivated(sessData) {

History

9 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
no conflicts, ready to merge
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
3/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/oauth: remove AuthReturnInfo
2/3 failed, 1/3 success
expand
expand 0 comments