diff --git a/internal/handlers/auth.go b/internal/handlers/auth.go index 4e4b993..09c6151 100644 --- a/internal/handlers/auth.go +++ b/internal/handlers/auth.go @@ -257,35 +257,10 @@ func renderError(w http.ResponseWriter, message string) { fmt.Fprintf(w, `
`, template.HTMLEscapeString(message)) } -// renderOTPForm writes the OTP verification form partial as an HTMX fragment. -// It renders 6 individual digit input boxes for a better mobile UX, plus a -// hidden email field. The handler combines the 6 digits server-side. -// If errMsg is non-empty, it is displayed as an error banner above the form. +// renderOTPForm writes the OTP verification form partial as an HTMX fragment +// using the cached otp_form template from templates.go. func renderOTPForm(w http.ResponseWriter, email string, errMsg string) { - tmpl := template.Must(template.New("otp_form").Parse(` - -`)) - + tmpl := getTemplate("otp_form") w.Header().Set("Content-Type", "text/html; charset=utf-8") if err := tmpl.Execute(w, map[string]string{"Email": email, "Error": errMsg}); err != nil { log.Printf("ERROR [%s] handlers: renderOTPForm execute: %v", time.Now().Format(time.RFC3339), err)