Don't allow empty tokens (#13)

This commit is contained in:
Adam Shiervani 2025-01-02 21:44:26 +01:00 committed by GitHub
parent ca815c06f1
commit e445039cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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") 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.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
c.Abort() c.Abort()
return return