Skip to content

Commit

Permalink
Fix up session saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Hunt committed Sep 3, 2015
1 parent 51885bb commit 799276a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions lib/connect-mysql-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,25 @@ module.exports = function (connect)
{
session.passport.user = session.user;
}

that.set(sid, session);
}
}

if(!session.cookie)
{
session.cookie = {};
}
if (!(session.cookie && session.cookie.expires) && session.last_activity)
{
session.cookie.expires = session.last_activity + parseInt(sails.config.session.cookie.maxAge);
}
if(!(session.cookie && session.cookie.originalMaxAge))
{
session.cookie.originalMaxAge = sails.config.session.cookie.maxAge;
}
session.cookie.domain = sails.config.session.cookie.domain;
if(!session.cookie)
{
session.cookie = {};
}
if (!(session.cookie && session.cookie.expires) && session.last_activity)
{
session.cookie.expires = session.last_activity + parseInt(sails.config.session.cookie.maxAge);
}
if(!(session.cookie && session.cookie.originalMaxAge))
{
session.cookie.originalMaxAge = sails.config.session.cookie.maxAge;
}
session.cookie.domain = sails.config.session.cookie.domain;

that.set(sid, session);


fn(null, session);
})
Expand Down

1 comment on commit 799276a

@krusynth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.