From efa917e4d4271b0ef9348306e7e1f66dccc972e2 Mon Sep 17 00:00:00 2001 From: "Bernhard K. Weisshuhn" Date: Fri, 18 Mar 2011 10:06:38 +0100 Subject: [PATCH] just ignore invalid cookie, don't throw. --- lib/cookie-sessions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cookie-sessions.js b/lib/cookie-sessions.js index f02a583..1ba8947 100644 --- a/lib/cookie-sessions.js +++ b/lib/cookie-sessions.js @@ -97,10 +97,10 @@ function extend(obj) { exports.deserialize = function(secret, timeout, str){ // Parses a secure cookie string, returning the object stored within it. - // Throws an exception if the secure cookie string does not validate. + // Ignores cookie if the secure cookie string does not validate. if(!exports.valid(secret, timeout, str)){ - throw new Error('invalid cookie'); + return undefined; } var data = exports.decrypt(secret, exports.split(str).data_blob); return JSON.parse(data);