Added CSRF.
This commit is contained in:
parent
1f258ea17e
commit
60d434a922
4 changed files with 14 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue