Showing posts with label remember me on web sites. Show all posts
Showing posts with label remember me on web sites. Show all posts

Tuesday, April 3, 2012

Best ways of implimenting “Remember Me” for your website


Taken from :  this and this

When the user successfully logs in with Remember Me checked, a
 login cookie is issued in addition to the standard session management cookie.You could use this strategy described here as best practice:
  1. The login cookie contains the user's username, a series identifier, and a token. The series and token are unguessable random numbers from a suitably large space. All three are stored together in a database table.
  2. When a non-logged-in user visits the site and presents a login cookie, the username, series, and token are looked up in the database.
    1. If the triplet is present, the user is considered authenticated. The used token is removedfrom the database. A new token is generated, stored in database with the username and the same series identifier, and a new login cookie containing all three is issued to the user.
    2. If the username and series are present but the token does not match, a theft is assumed. The user receives a strongly worded warning and all of the user's remembered sessions are deleted.
    3. If the username and series are not present, the login cookie is ignored.

Featured Posts

Run Commands for Windows

  🖥️ CPL Files (Control Panel Applets) Run via Win + R → filename.cpl Command Opens appwiz.cpl P...