Monorepo for Tangled

appview/state: normalize handle on login

Signed-off-by: oppiliappan <me@oppi.li>

+8 -1
+8 -1
appview/state/login.go
··· 39 39 returnURL := r.FormValue("return_url") 40 40 addAccount := r.FormValue("add_account") == "true" 41 41 42 + // remove spaces around the handle, handles can't have spaces around them 43 + handle = strings.TrimSpace(handle) 44 + 42 45 // when users copy their handle from bsky.app, it tends to have these characters around it: 43 46 // 44 47 // @nelind.dk: ··· 68 71 redirectURL, err := s.oauth.ClientApp.StartAuthFlow(r.Context(), handle) 69 72 if err != nil { 70 73 l.Error("failed to start auth", "err", err) 71 - http.Error(w, err.Error(), http.StatusInternalServerError) 74 + s.pages.Notice( 75 + w, 76 + "login-msg", 77 + fmt.Sprintf("Failed to start auth flow: %v", err), 78 + ) 72 79 return 73 80 } 74 81