From 70302c27ea0803a00cf0cfbb551a0eb4027b5232 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 5 Jan 2026 13:44:02 -0500 Subject: [PATCH] chore: remove deprecated templ files and update auth routes BREAKING: migrates to templ from html templates in login, register and welcome pages --- _migrate/login.html | 561 ---------------------------------- _migrate/register.html | 680 ----------------------------------------- _migrate/welcome.html | 536 -------------------------------- handlers/routes.go | 37 +++ 4 files changed, 37 insertions(+), 1777 deletions(-) delete mode 100644 _migrate/login.html delete mode 100644 _migrate/register.html delete mode 100644 _migrate/welcome.html diff --git a/_migrate/login.html b/_migrate/login.html deleted file mode 100644 index 40859aa..0000000 --- a/_migrate/login.html +++ /dev/null @@ -1,561 +0,0 @@ - - - - - - - Sign In - Sonr - - - - - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- - - Create Account - -
-
-
-
- - - - diff --git a/_migrate/register.html b/_migrate/register.html deleted file mode 100644 index 9b4395d..0000000 --- a/_migrate/register.html +++ /dev/null @@ -1,680 +0,0 @@ - - - - - - - Create Account - Sonr - - - - - -
- -
-
-
-
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- - Sign In -
-
-
-
- - - - diff --git a/_migrate/welcome.html b/_migrate/welcome.html deleted file mode 100644 index 89a6cdf..0000000 --- a/_migrate/welcome.html +++ /dev/null @@ -1,536 +0,0 @@ - - - - - - - Welcome - Sonr Motr Wallet - - - - - -
- -
-
-
-
1
- Welcome -
-
-
-
2
- Learn -
-
-
-
3
- Get Started -
-
-
- -
- -
- -
- -
- -
- -
- -
- -
-
-
-
- - - - diff --git a/handlers/routes.go b/handlers/routes.go index 9d5b771..13712cf 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -16,6 +16,10 @@ func RegisterRoutes(mux *http.ServeMux) { mux.HandleFunc("GET /register/step/{step}", handleRegisterStep) mux.HandleFunc("GET /register/capabilities", handleRegisterCapabilities) mux.HandleFunc("POST /register/verify-code", handleRegisterVerifyCode) + + mux.HandleFunc("GET /login", handleLogin) + mux.HandleFunc("GET /login/step/{step}", handleLoginStep) + mux.HandleFunc("GET /login/qr-status", handleLoginQRStatus) } // handleWelcome renders the full welcome page at step 1 @@ -85,3 +89,36 @@ func handleRegisterVerifyCode(w http.ResponseWriter, r *http.Request) { } views.RegisterPage(state).Render(r.Context(), w) } + +func handleLogin(w http.ResponseWriter, r *http.Request) { + state := views.LoginState{Step: "1"} + views.LoginPage(state).Render(r.Context(), w) +} + +func handleLoginStep(w http.ResponseWriter, r *http.Request) { + step := r.PathValue("step") + if step == "" { + step = "1" + } + + state := views.LoginState{Step: step} + + if r.Header.Get("HX-Request") == "true" { + views.LoginStepWithOOB(state).Render(r.Context(), w) + return + } + + views.LoginPage(state).Render(r.Context(), w) +} + +var qrPollCount = 0 + +func handleLoginQRStatus(w http.ResponseWriter, r *http.Request) { + qrPollCount++ + if qrPollCount >= 3 { + qrPollCount = 0 + views.QRStatusSuccess().Render(r.Context(), w) + return + } + views.QRStatusWaiting().Render(r.Context(), w) +}