Added CSRF.

This commit is contained in:
mikestefanello 2021-12-03 07:53:01 -05:00
parent 1f258ea17e
commit 60d434a922
4 changed files with 14 additions and 0 deletions

View file

@ -7,6 +7,8 @@ import (
"goweb/msg"
"goweb/pager"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo/v4"
)
@ -31,6 +33,7 @@ type Page struct {
Keywords []string
}
Pager pager.Pager
CSRF string
}
func NewPage(c echo.Context) Page {
@ -44,6 +47,10 @@ func NewPage(c echo.Context) Page {
p.IsHome = p.Path == "/"
if csrf := c.Get(middleware.DefaultCSRFConfig.ContextKey); csrf != nil {
p.CSRF = csrf.(string)
}
return p
}