fix: change logout route from GET to POST
This commit is contained in:
@@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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"},
|
||||||
|
|||||||
Reference in New Issue
Block a user