From a241995734cecff39f57732916a73052caf4c175 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sat, 7 Feb 2026 18:35:43 -1000 Subject: Fix passkey registration showing broken UI when WebAuthn not configured Root cause: WEBAUTHN_RP_ID and WEBAUTHN_ORIGIN env vars not set in production, so WebAuthn is nil and all passkey endpoints return 404. The settings page was unconditionally showing the passkey registration card, leading to confusing "Failed to start registration" errors. Fix: Pass WebAuthnEnabled flag from main.go through Handler to the settings template, which now conditionally renders the passkey card only when WebAuthn is properly configured. Co-Authored-By: Claude Opus 4.6 --- internal/handlers/settings.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'internal/handlers/settings.go') diff --git a/internal/handlers/settings.go b/internal/handlers/settings.go index 60fc6be..0ad362b 100644 --- a/internal/handlers/settings.go +++ b/internal/handlers/settings.go @@ -22,15 +22,17 @@ func (h *Handler) HandleSettingsPage(w http.ResponseWriter, r *http.Request) { } data := struct { - Configs map[string][]models.SourceConfig - Sources []string - Toggles []models.FeatureToggle - CSRFToken string + Configs map[string][]models.SourceConfig + Sources []string + Toggles []models.FeatureToggle + CSRFToken string + WebAuthnEnabled bool }{ - Configs: bySource, - Sources: []string{"trello", "todoist", "gcal", "gtasks"}, - Toggles: toggles, - CSRFToken: auth.GetCSRFTokenFromContext(r.Context()), + Configs: bySource, + Sources: []string{"trello", "todoist", "gcal", "gtasks"}, + Toggles: toggles, + CSRFToken: auth.GetCSRFTokenFromContext(r.Context()), + WebAuthnEnabled: h.WebAuthnEnabled, } if err := h.renderer.Render(w, "settings.html", data); err != nil { -- cgit v1.2.3