Monorepo for Tangled

appview/signup: redirect forms on home page to signup page

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

authored by

oppiliappan and committed by tangled.org 1e28cac1 c4216345

+10 -3
+1
appview/pages/pages.go
··· 260 260 261 261 type SignupParams struct { 262 262 CloudflareSiteKey string 263 + EmailId string 263 264 } 264 265 265 266 func (p *Pages) Signup(w io.Writer, params SignupParams) error {
+2 -2
appview/pages/templates/timeline/fragments/hero.html
··· 10 10 communities can freely self-govern and most importantly, coding can 11 11 be social and fun again. 12 12 </p> 13 - <form class="flex gap-2 items-stretch"> 13 + <form class="flex gap-2 items-stretch" method="get" action="/signup"> 14 14 <input 15 15 type="email" 16 16 id="email" 17 - name="email" 17 + name="id" 18 18 tabindex="4" 19 19 required 20 20 placeholder="Enter your email"
+1
appview/pages/templates/user/signup.html
··· 20 20 tabindex="4" 21 21 required 22 22 placeholder="jason@bourne.co" 23 + value="{{ .EmailId }}" 23 24 /> 24 25 </div> 25 26 <span class="text-sm text-gray-500 mt-1">
+2
appview/signup/signup.go
··· 118 118 func (s *Signup) signup(w http.ResponseWriter, r *http.Request) { 119 119 switch r.Method { 120 120 case http.MethodGet: 121 + emailId := r.URL.Query().Get("id") 121 122 s.pages.Signup(w, pages.SignupParams{ 122 123 CloudflareSiteKey: s.config.Cloudflare.TurnstileSiteKey, 124 + EmailId: emailId, 123 125 }) 124 126 case http.MethodPost: 125 127 if s.cf == nil {
+1
appview/state/router.go
··· 120 120 r.Handle("/static/*", s.pages.Static()) 121 121 122 122 r.Get("/", s.HomeOrTimeline) 123 + r.Get("/home", s.Home) 123 124 r.Get("/timeline", s.Timeline) 124 125 r.Get("/upgradeBanner", s.UpgradeBanner) 125 126
+3 -1
appview/state/timeline.go
··· 13 13 // TODO: set this flag based on the UI 14 14 filtered := false 15 15 16 + user := s.oauth.GetMultiAccountUser(r) 17 + 16 18 timeline, err := db.MakeTimeline(s.db, 50, "", filtered) 17 19 if err != nil { 18 20 s.logger.Error("failed to make timeline", "err", err) ··· 26 28 } 27 29 28 30 fmt.Println(s.pages.Home(w, pages.TimelineParams{ 29 - LoggedInUser: nil, 31 + LoggedInUser: user, 30 32 Timeline: timeline, 31 33 BlueskyPosts: blueskyPosts, 32 34 }))