You will almost certainly not renew your session cookie in order to live long.
Although this is not about rails in this article , you will find a few examples to explain the best Remember Me methods.
In summary, although you should:
- Add an extra column to the user table to accept a large random value
- Set a long-lived cookie on the client that combines user ID and random value
- When a new session begins, check for the id / value cookie and authenticate the new user if they match.
The author also recommends that you do not invalidate the random value and reset the cookie every time you log in. Personally, I donโt like it, because then you canโt enter the site on two computers. I would like to make sure that my password change function also reset a random variable that blocks sessions on other machines.
As a final note, the tips that he gives to perform certain functions (password change / email change, etc.) that are not available for auto-session sessions are noteworthy, but rarely found in the real world.
Gareth Simpson Aug 02 '08 at 16:10 2008-08-02 16:10
source share