fix: allow registration only if authenticated

This commit is contained in:
2026-02-05 18:11:44 +01:00
parent 904dbd7b1c
commit d4d1bde0ee

View File

@@ -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)