From 9a399c13a376691ef8abb645da8498c2e1404f64 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Sat, 31 Dec 2016 03:28:29 +0100 Subject: [PATCH] Remove login test-routes --- http/http.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/http/http.go b/http/http.go index f6f284f..8699c8e 100644 --- a/http/http.go +++ b/http/http.go @@ -38,17 +38,6 @@ func (h *Handler) Serve() { api.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") }) api.POST("/login", h.loginPost) api.POST("/register", h.registerPost) - - // Unauthenticated routes - api.GET("/check", func(c *gin.Context) { c.String(http.StatusOK, "Accessible") }) - api.GET("/hello", func(c *gin.Context) { c.String(http.StatusOK, "Hello, World!") }) - - // Restricted group - r := api.Group("/restricted") - { - //r.Use(middleware.JWT([]byte(secret))) - r.GET("", h.restricted) - } } router.Run(":1323") @@ -68,17 +57,6 @@ func (h *Handler) dashboard(c *gin.Context) { c.HTML(http.StatusOK, "dashboard", d) } -func (h *Handler) restricted(c *gin.Context) { - token, err := h.verifyLogin(c) - if err != nil { - c.Redirect(http.StatusTemporaryRedirect, "/login") - return - } - - name := token.GetName() - c.String(http.StatusOK, "Welcome "+name+"!") -} - func (h *Handler) verifyLogin(c *gin.Context) (budgeteer.Token, error) { tokenString, err := c.Cookie(authCookie) if err != nil {