Small auth cleanup

This commit is contained in:
Dominic Ferrando
2025-04-23 15:12:46 -04:00
parent 098c65be70
commit a28cb483fa
3 changed files with 15 additions and 17 deletions
-12
View File
@@ -3,7 +3,6 @@ package util
import (
"crypto/rand"
"encoding/hex"
"net/http"
"sync"
"time"
)
@@ -66,14 +65,3 @@ func HasExistingAdminSession(username string) bool {
return false
}
func AdminOnlyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
c, err := r.Cookie("comfy_admin")
if err != nil || !IsAdminSessionValid(c.Value) {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
next.ServeHTTP(w, r)
})
}