CRITICAL: error in template prevents login #146

Closed
opened 2026-02-26 11:54:05 +01:00 by sneak · 1 comment
Owner
upaas                   | {"time":"2026-02-26T10:52:07.898637757Z","level":"ERROR","source":{"function":"git.eeqj.de/sneak/upaas/internal/handlers.(*Handlers).renderTemplate","file":"/src/internal/handlers/handlers.go","line":98},"msg":"template execution failed","error":"execute page template dashboard.html: template: dashboard.html:72:19: executing \"content\" at <.CSRFField>: can't evaluate field CSRFField in type *handlers.AppStats"}

giving 5xx after login. please write a failing test first, commit that, then fix it.

``` upaas | {"time":"2026-02-26T10:52:07.898637757Z","level":"ERROR","source":{"function":"git.eeqj.de/sneak/upaas/internal/handlers.(*Handlers).renderTemplate","file":"/src/internal/handlers/handlers.go","line":98},"msg":"template execution failed","error":"execute page template dashboard.html: template: dashboard.html:72:19: executing \"content\" at <.CSRFField>: can't evaluate field CSRFField in type *handlers.AppStats"} ``` giving 5xx after login. please write a failing test first, commit that, then fix it.
clawbot was assigned by sneak 2026-02-26 11:54:05 +01:00
sneak added this to the 1.0 milestone 2026-02-26 11:54:15 +01:00
Collaborator

Fixed in PR #147. The root cause: templates/dashboard.html line 72 uses .CSRFField inside {{range .AppStats}}, where . refers to *handlers.AppStats (which has no CSRFField). Changed to $.CSRFField to reference the root template data map. Added a regression test that creates an app before rendering the dashboard.

Fixed in PR #147. The root cause: `templates/dashboard.html` line 72 uses `.CSRFField` inside `{{range .AppStats}}`, where `.` refers to `*handlers.AppStats` (which has no CSRFField). Changed to `$.CSRFField` to reference the root template data map. Added a regression test that creates an app before rendering the dashboard.
sneak closed this issue 2026-02-26 12:07:43 +01:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/upaas#146