ch11.7
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"gitea.local.lab/Lbenedar/snippetbox/internal/models"
|
||||
"github.com/justinas/nosurf"
|
||||
)
|
||||
|
||||
type templateData struct {
|
||||
@@ -16,6 +17,7 @@ type templateData struct {
|
||||
Form any
|
||||
Flash string
|
||||
IsAuthenticated bool
|
||||
CSRFToken string
|
||||
}
|
||||
|
||||
func humanDate(t time.Time) string {
|
||||
@@ -31,6 +33,7 @@ func (app *application) newTemplateData(r *http.Request) *templateData {
|
||||
CurrentYear: time.Now().Year(),
|
||||
Flash: app.sessionManager.PopString(r.Context(), "flash"),
|
||||
IsAuthenticated: app.isAuthenticated(r),
|
||||
CSRFToken: nosurf.Token(r),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user