diff options
Diffstat (limited to '')
-rw-r--r-- | csrf.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -19,9 +19,13 @@ func csrfHandler(next http.Handler) http.Handler { // Csrf handles the CSRF data for a form. // Include it verbatim and then use `{{.CsrfField}}` in templates. type Csrf struct { - CsrfField template.HTML `form:"-"` + CsrfField template.HTML `form:"-" schema:"-"` } -func CsrfField(r *http.Request) Csrf { - return Csrf{CsrfField: csrf.TemplateField(r)} +func (c *Csrf) SetCsrfField(r *http.Request) { + c.CsrfField = csrf.TemplateField(r) +} + +type WithCsrf interface { + SetCsrfField(r *http.Request) } |