Writing auth middleware

This commit is contained in:
2024-07-19 18:40:19 +02:00
parent a6dca00199
commit a0853cf880
4 changed files with 22 additions and 3 deletions

View File

@ -24,3 +24,7 @@ func ServerError(w http.ResponseWriter, err error) {
app.ErrorLog.Println(trace)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
func IsAuthenticated(r *http.Request) bool {
return app.Session.Exists(r.Context(), "user_id")
}