Clean up error handling, migrate to log/slog, add todo for flash message system in post controller

This commit is contained in:
Maximilian
2023-09-03 15:45:12 -05:00
parent ee4c9f9199
commit ed712a5344
10 changed files with 51 additions and 68 deletions

View File

@ -2,7 +2,7 @@ package middleware
import (
"GoWeb/security"
"log"
"log/slog"
"net/http"
)
@ -11,7 +11,7 @@ func Csrf(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWr
return func(w http.ResponseWriter, r *http.Request) {
_, err := security.VerifyCsrfToken(r)
if err != nil {
log.Println("Error verifying csrf token")
slog.Info("error verifying csrf token")
http.Error(w, "Forbidden", http.StatusForbidden)
return
}