diff --git a/http/http.go b/http/http.go index 23cb8ad..e492559 100644 --- a/http/http.go +++ b/http/http.go @@ -23,7 +23,6 @@ type Handler struct { const ( expiration = 72 - authCookie = "authentication" ) // Serve starts the HTTP Server @@ -76,9 +75,6 @@ func (h *Handler) Serve() { authenticated.Use(h.verifyLoginWithForbidden) authenticated.GET("/dashboard", h.dashboard) - user := authenticated.Group("/user") - user.GET("/logout", logout) - budget := authenticated.Group("/budget") budget.POST("/new", h.newBudget) diff --git a/http/session.go b/http/session.go index f05e5b0..197b9d5 100644 --- a/http/session.go +++ b/http/session.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "net/http" - "time" "git.javil.eu/jacob1123/budgeteer" "git.javil.eu/jacob1123/budgeteer/postgres" @@ -16,7 +15,6 @@ func (h *Handler) verifyLogin(c *gin.Context) (budgeteer.Token, error) { tokenString = tokenString[7:] token, err := h.TokenVerifier.VerifyToken(tokenString) if err != nil { - c.SetCookie(authCookie, "", -1, "", "", false, false) return nil, fmt.Errorf("verify token '%s': %w", tokenString, err) } @@ -65,14 +63,6 @@ func (h *Handler) register(c *gin.Context) { c.HTML(http.StatusOK, "register.html", nil) } -func logout(c *gin.Context) { - clearLogin(c) -} - -func clearLogin(c *gin.Context) { - c.SetCookie(authCookie, "", -1, "", "", false, true) -} - type loginInformation struct { Password string `json:"password"` User string `json:"user"` @@ -103,8 +93,6 @@ func (h *Handler) loginPost(c *gin.Context) { go h.Service.UpdateLastLogin(context.Background(), user.ID) - maxAge := (int)((expiration * time.Hour).Seconds()) - c.SetCookie(authCookie, t, maxAge, "", "", false, true) c.JSON(http.StatusOK, map[string]string{ "token": t, })