refactor: use centralized session cookie helpers
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user