next-session
Advanced tools
Comparing version 3.4.2 to 3.4.3
@@ -113,2 +113,10 @@ "use strict"; | ||
} | ||
// Extends the expiry of the session | ||
// if touchAfter is applicable | ||
if (touchAfter >= 0 && session.cookie.expires) { | ||
const lastTouchedTime = session.cookie.expires.getTime() - session.cookie.maxAge * 1000; | ||
if (_now - lastTouchedTime >= touchAfter) { | ||
resetMaxAge(session); | ||
} | ||
} | ||
} | ||
@@ -163,10 +171,2 @@ else { | ||
} | ||
// Extends the expiry of the session | ||
// if touchAfter is applicable | ||
if (touchAfter >= 0 && session.cookie.expires) { | ||
const lastTouchedTime = session.cookie.expires.getTime() - session.cookie.maxAge * 1000; | ||
if (_now - lastTouchedTime >= touchAfter) { | ||
resetMaxAge(session); | ||
} | ||
} | ||
// autocommit: We commit the header and save the session automatically | ||
@@ -178,3 +178,5 @@ // by "proxying" res.writeHead and res.end methods. After committing, we | ||
res.writeHead = function resWriteHeadProxy(...args) { | ||
if (session.isNew || isTouched || isDestroyed) { | ||
if ((session.isNew && Object.keys(session).length > 1) || | ||
isTouched || | ||
isDestroyed) { | ||
commitHead(res, name, session, encode); | ||
@@ -181,0 +183,0 @@ } |
{ | ||
"name": "next-session", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"description": "Simple promise-based session middleware for Next.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
413
31210
17