Checking to see if a user is logged in, and logging a user our

This commit is contained in:
2024-07-22 10:00:17 +02:00
parent a0853cf880
commit 96f81418ec
5 changed files with 26 additions and 9 deletions

View File

@ -32,6 +32,9 @@ func AddDefaultData(td *models.TemplateData, r *http.Request) *models.TemplateDa
td.Warning = app.Session.PopString(r.Context(), "warning")
td.Error = app.Session.PopString(r.Context(), "error")
td.CSRFToken = nosurf.Token(r)
if app.Session.Exists(r.Context(), "user_id") {
td.IsAuthenticated = 1
}
return td
}