add frontend auth middleware, embed user data in frontend html

This commit is contained in:
sam 2023-09-04 17:32:45 +02:00
parent d8cb8c8fa8
commit 0fa769a248
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
12 changed files with 265 additions and 42 deletions

View file

@ -7,6 +7,13 @@ import (
"github.com/flosch/pongo2/v6"
)
func (app *App) ErrorTemplate(w http.ResponseWriter, r *http.Request, header, desc string) error {
return app.Template(w, r, "error.tpl", pongo2.Context{
"header": header,
"description": desc,
})
}
func (app *App) Template(w http.ResponseWriter, r *http.Request, tmplName string, ctx pongo2.Context) error {
tmpl, err := app.tmpl.FromCache(tmplName)
if err != nil {