Monorepo for Tangled tangled.org

appview/{oauth,pages,state}: remove unused AddAccount session data #1020

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

idk why is this added. Seems like it isn't used?

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

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3mdcq5ouzcc22
+5 -12
Diff #8
+3 -7
appview/oauth/accounts.go
··· 127 127 } 128 128 129 129 type AuthReturnInfo struct { 130 - ReturnURL string 131 - AddAccount bool 130 + ReturnURL string 132 131 } 133 132 134 - func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string, addAccount bool) error { 133 + func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string) error { 135 134 session, err := o.SessStore.Get(r, AuthReturnName) 136 135 if err != nil { 137 136 return err 138 137 } 139 138 140 139 session.Values[AuthReturnURL] = returnURL 141 - session.Values[AuthAddAccount] = addAccount 142 140 session.Options.MaxAge = 60 * 30 143 141 session.Options.HttpOnly = true 144 142 session.Options.Secure = !o.Config.Core.Dev ··· 154 152 } 155 153 156 154 returnURL, _ := session.Values[AuthReturnURL].(string) 157 - addAccount, _ := session.Values[AuthAddAccount].(bool) 158 155 159 156 return &AuthReturnInfo{ 160 - ReturnURL: returnURL, 161 - AddAccount: addAccount, 157 + ReturnURL: returnURL, 162 158 } 163 159 } 164 160
-1
appview/oauth/consts.go
··· 5 5 AccountsName = "appview-accounts-v2" 6 6 AuthReturnName = "appview-auth-return" 7 7 AuthReturnURL = "return_url" 8 - AuthAddAccount = "add_account" 9 8 SessionHandle = "handle" 10 9 SessionDid = "did" 11 10 SessionId = "id"
+1 -1
appview/oauth/oauth.go
··· 396 396 info.AccountDID = &parsedDid 397 397 o.ClientApp.Store.SaveAuthRequestInfo(ctx, *info) 398 398 399 - if err := o.SetAuthReturn(w, r, returnURL, false); err != nil { 399 + if err := o.SetAuthReturn(w, r, returnURL); err != nil { 400 400 return "", fmt.Errorf("failed to set auth return: %w", err) 401 401 } 402 402
-1
appview/pages/templates/user/login.html
··· 73 73 </span> 74 74 </div> 75 75 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 76 - <input type="hidden" name="add_account" value="{{ if .AddAccount }}true{{ end }}"> 77 76 78 77 <button 79 78 class="btn w-full my-2 mt-6 text-base"
+1 -2
appview/state/login.go
··· 31 31 case http.MethodPost: 32 32 handle := r.FormValue("handle") 33 33 returnURL := r.FormValue("return_url") 34 - addAccount := r.FormValue("add_account") == "true" 35 34 36 35 // remove spaces around the handle, handles can't have spaces around them 37 36 handle = strings.TrimSpace(handle) ··· 87 86 } 88 87 } 89 88 90 - if err := s.oauth.SetAuthReturn(w, r, returnURL, addAccount); err != nil { 89 + if err := s.oauth.SetAuthReturn(w, r, returnURL); err != nil { 91 90 l.Error("failed to set auth return", "err", err) 92 91 } 93 92

History

9 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 timeout, 1/3 success
expand
no conflicts, ready to merge
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
3/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/{oauth,pages,state}: remove unused AddAccount session data
2/3 failed, 1/3 success
expand
expand 0 comments