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
+4 -11
Diff #1
+3 -7
appview/oauth/accounts.go
··· 127 } 128 129 type AuthReturnInfo struct { 130 - ReturnURL string 131 - AddAccount bool 132 } 133 134 - func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string, addAccount bool) error { 135 session, err := o.SessStore.Get(r, AuthReturnName) 136 if err != nil { 137 return err 138 } 139 140 session.Values[AuthReturnURL] = returnURL 141 - session.Values[AuthAddAccount] = addAccount 142 session.Options.MaxAge = 60 * 30 143 session.Options.HttpOnly = true 144 session.Options.Secure = !o.Config.Core.Dev ··· 154 } 155 156 returnURL, _ := session.Values[AuthReturnURL].(string) 157 - addAccount, _ := session.Values[AuthAddAccount].(bool) 158 159 return &AuthReturnInfo{ 160 - ReturnURL: returnURL, 161 - AddAccount: addAccount, 162 } 163 } 164
··· 127 } 128 129 type AuthReturnInfo struct { 130 + ReturnURL string 131 } 132 133 + func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string) error { 134 session, err := o.SessStore.Get(r, AuthReturnName) 135 if err != nil { 136 return err 137 } 138 139 session.Values[AuthReturnURL] = returnURL 140 session.Options.MaxAge = 60 * 30 141 session.Options.HttpOnly = true 142 session.Options.Secure = !o.Config.Core.Dev ··· 152 } 153 154 returnURL, _ := session.Values[AuthReturnURL].(string) 155 156 return &AuthReturnInfo{ 157 + ReturnURL: returnURL, 158 } 159 } 160
-1
appview/oauth/consts.go
··· 5 AccountsName = "appview-accounts-v2" 6 AuthReturnName = "appview-auth-return" 7 AuthReturnURL = "return_url" 8 - AuthAddAccount = "add_account" 9 SessionHandle = "handle" 10 SessionDid = "did" 11 SessionId = "id"
··· 5 AccountsName = "appview-accounts-v2" 6 AuthReturnName = "appview-auth-return" 7 AuthReturnURL = "return_url" 8 SessionHandle = "handle" 9 SessionDid = "did" 10 SessionId = "id"
-1
appview/pages/templates/user/login.html
··· 93 </span> 94 </div> 95 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 96 - <input type="hidden" name="add_account" value="{{ if .AddAccount }}true{{ end }}"> 97 98 <button 99 class="btn w-full my-2 mt-6 text-base "
··· 93 </span> 94 </div> 95 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 96 97 <button 98 class="btn w-full my-2 mt-6 text-base "
+1 -2
appview/state/login.go
··· 27 case http.MethodPost: 28 handle := r.FormValue("handle") 29 returnURL := r.FormValue("return_url") 30 - addAccount := r.FormValue("add_account") == "true" 31 32 // when users copy their handle from bsky.app, it tends to have these characters around it: 33 // ··· 51 return 52 } 53 54 - if err := s.oauth.SetAuthReturn(w, r, returnURL, addAccount); err != nil { 55 l.Error("failed to set auth return", "err", err) 56 } 57
··· 27 case http.MethodPost: 28 handle := r.FormValue("handle") 29 returnURL := r.FormValue("return_url") 30 31 // when users copy their handle from bsky.app, it tends to have these characters around it: 32 // ··· 50 return 51 } 52 53 + if err := s.oauth.SetAuthReturn(w, r, returnURL); err != nil { 54 l.Error("failed to set auth return", "err", err) 55 } 56

History

3 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 failed, 1/3 success
expand
merge conflicts detected
expand
  • appview/pages/templates/user/login.html:33
  • appview/state/profile.go:817
  • appview/pages/templates/user/login.html:31
  • appview/pages/templates/user/login.html:93
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