From 783a726efa78982346fe695676ffd8baaba26eb0 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Sun, 25 Jan 2026 11:57:12 +0000 Subject: [PATCH] appview/oauth: remove `AuthReturnInfo` Signed-off-by: Seongmin Lee --- appview/oauth/accounts.go | 12 +++--------- appview/oauth/handler.go | 7 +++---- 2 file(s) changed, 6 insertion(s)(+), 13 deletion(s)(-) diff --git a/appview/oauth/accounts.go b/appview/oauth/accounts.go --- a/appview/oauth/accounts.go +++ b/appview/oauth/accounts.go @@ -126,10 +126,6 @@ } } -type AuthReturnInfo struct { - ReturnURL string -} - func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string) error { session, err := o.SessStore.Get(r, AuthReturnName) if err != nil { @@ -145,17 +141,15 @@ return session.Save(r, w) } -func (o *OAuth) GetAuthReturn(r *http.Request) *AuthReturnInfo { +func (o *OAuth) GetAuthReturn(r *http.Request) string { session, err := o.SessStore.Get(r, AuthReturnName) if err != nil || session.IsNew { - return &AuthReturnInfo{} + return "" } returnURL, _ := session.Values[AuthReturnURL].(string) - return &AuthReturnInfo{ - ReturnURL: returnURL, - } + return returnURL } func (o *OAuth) ClearAuthReturn(w http.ResponseWriter, r *http.Request) error { diff --git a/appview/oauth/handler.go b/appview/oauth/handler.go --- a/appview/oauth/handler.go +++ b/appview/oauth/handler.go @@ -64,7 +64,7 @@ ctx := r.Context() l := o.Logger.With("query", r.URL.Query()) - authReturn := o.GetAuthReturn(r) + redirectURL := o.GetAuthReturn(r) _ = o.ClearAuthReturn(w, r) sessData, err := o.ClientApp.ProcessCallback(ctx, r.URL.Query()) @@ -108,9 +108,8 @@ } } - redirectURL := "/" - if authReturn.ReturnURL != "" { - redirectURL = authReturn.ReturnURL + if redirectURL == "" { + redirectURL = "/" } if o.isAccountDeactivated(sessData) { -- tangled.sh