Don't allow empty tokens

This commit is contained in:
Adam Shiervani 2025-01-02 20:59:40 +01:00
parent ed93400758
commit eabbdafc1f
1 changed files with 1 additions and 1 deletions

2
web.go
View File

@ -192,7 +192,7 @@ func protectedMiddleware() gin.HandlerFunc {
}
authToken, err := c.Cookie("authToken")
if err != nil || authToken != config.LocalAuthToken {
if err != nil || authToken != config.LocalAuthToken || authToken == "" {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
c.Abort()
return