fix: change logout route from GET to POST

This commit is contained in:
2026-06-27 21:05:41 +02:00
parent 6edb93d5af
commit a74087aa2a
2 changed files with 3 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ func NewAuthHandler(svc domain.AuthService) *AuthHandler {
func (h *AuthHandler) Register(r *gin.Engine) { func (h *AuthHandler) Register(r *gin.Engine) {
r.GET("/login", h.HandleLoginPage) r.GET("/login", h.HandleLoginPage)
r.POST("/login", h.HandleLogin) r.POST("/login", h.HandleLogin)
r.GET("/logout", h.HandleLogout) r.POST("/logout", h.HandleLogout)
r.POST("/api/auth/login", h.HandleAPILogin) r.POST("/api/auth/login", h.HandleAPILogin)
} }
@@ -60,7 +60,7 @@ func (h *AuthHandler) HandleLogout(c *gin.Context) {
} }
} }
c.SetCookie("session_id", "", -1, "/", "", false, true) clearSessionCookie(c)
c.Redirect(http.StatusSeeOther, "/login") c.Redirect(http.StatusSeeOther, "/login")
} }

View File

@@ -18,7 +18,7 @@ var publicRoutes = []publicRoute{
// Pages. // Pages.
{method: http.MethodGet, path: "/login"}, {method: http.MethodGet, path: "/login"},
{method: http.MethodPost, path: "/login"}, {method: http.MethodPost, path: "/login"},
{method: http.MethodGet, path: "/logout"}, {method: http.MethodPost, path: "/logout"},
// Crawler noise. // Crawler noise.
{method: http.MethodGet, path: "/robots.txt"}, {method: http.MethodGet, path: "/robots.txt"},