refactor: use centralized session cookie helpers

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

View File

@@ -43,7 +43,7 @@ func (h *AuthHandler) HandleLogin(c *gin.Context) {
return return
} }
c.SetCookie("session_id", session.ID, int(domain.SessionLifetime.Seconds()), "/", "", false, true) setPersistentSessionCookie(c, session.ID)
if c.GetHeader("HX-Request") == "true" { if c.GetHeader("HX-Request") == "true" {
c.Header("HX-Redirect", "/") c.Header("HX-Redirect", "/")
c.Status(http.StatusOK) c.Status(http.StatusOK)

View File

@@ -112,7 +112,7 @@ func AuthMiddleware(svc domain.AuthService) gin.HandlerFunc {
if usesCookieSession { if usesCookieSession {
if refreshErr := svc.RefreshSession(c.Request.Context(), sessionID); refreshErr == nil { if refreshErr := svc.RefreshSession(c.Request.Context(), sessionID); refreshErr == nil {
c.SetCookie("session_id", sessionID, int(domain.SessionLifetime.Seconds()), "/", "", false, true) setPersistentSessionCookie(c, sessionID)
} }
} }