Monorepo for Tangled tangled.org
771
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/oauth: remove `AuthReturnInfo`

Signed-off-by: Seongmin Lee <git@boltless.me>

authored by

Seongmin Lee and committed by
Tangled
783a726e 9b3145e0

+6 -13
+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
··· 64 64 ctx := r.Context() 65 65 l := o.Logger.With("query", r.URL.Query()) 66 66 67 - authReturn := o.GetAuthReturn(r) 67 + redirectURL := o.GetAuthReturn(r) 68 68 _ = o.ClearAuthReturn(w, r) 69 69 70 70 sessData, err := o.ClientApp.ProcessCallback(ctx, r.URL.Query()) ··· 108 108 } 109 109 } 110 110 111 - redirectURL := "/" 112 - if authReturn.ReturnURL != "" { 113 - redirectURL = authReturn.ReturnURL 111 + if redirectURL == "" { 112 + redirectURL = "/" 114 113 } 115 114 116 115 if o.isAccountDeactivated(sessData) {