From d4d1bde0eed982f1fca214ad53487edadffba31b Mon Sep 17 00:00:00 2001 From: Kristjan Komlosi Date: Thu, 5 Feb 2026 18:11:44 +0100 Subject: [PATCH] fix: allow registration only if authenticated --- cmd/server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 512d515..1388d46 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -117,13 +117,13 @@ func main() { r.GET("/health", h.Health) r.GET("/hello", h.Hello) r.POST("/login", h.Login) - r.POST("/register", h.Register) r.GET("/devices", h.GetDevices) // mqttping endpoint handled by internal/handler (protected) // Protected routes auth := r.Group("/") + auth.POST("/register", h.Register) auth.Use(middleware.AuthMiddleware(cfg.Server.JWTSecret)) auth.GET("/protected", h.Protected) auth.GET("/mqttping", h.MQTTPing)