sails.js Sessions - rememberme functionality -


i have been trying implement rememberme functionality using sails. want session persist until browser closed. however, if rememberme checkbox ticked when user logins in want session persist 30 days. used remember me passport strategy here: https://github.com/jaredhanson/passport-remember-me ends sitting on top of sails session , 1 called first ends superseding other.

you can set cookie age before calling login function.

i did in login controller -> passport.callback.

passport.callback(req, res, function (err, user, challenges, statuses) {         ...          if (req.param('remember', false) == true) {             req.session.cookie.maxage = 1000 * 60 * 60 * 24 * 30;         }         req.login(user, function (err) {         ...         } }  

this doesn't feel right and, if sending other cookies when logging in, affect lifetime well.

but works , went since finding documentation sails-related stuff digging oil.

also, noticed passport not destroying sessions upon , had manually calling req.session.destroy(); in logout controller.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -