javascript - Add Remember Functionality in Website to load same page when url is loaded -
i making app local html files inside assets folder in android studio. when opened first open index.html files specified. routine application, wondering if add remember functionality, such when user loads application, they'll automatically redirects same page have checked , provides reset in case want reset choice in future.
any appreciated.
improved persistent login cookie best practice
you use strategy described here best practice (2006) or an updated strategy described here (2015):
- when user logs in remember me checked, login cookie issued in addition standard session management cookie.
- the login cookie contains a series identifier , token. series , token unguessable random numbers suitably large space. both stored in database table, the token hashed (sha256 fine).
- when non-logged-in user visits site , presents login cookie, series identifier looked in database.
- if series identifier present , hash of token matches hash series identifier, user considered authenticated. new token generated, new hash token stored on old record, , new login cookie issued user (it's okay re-use series identifier).
- if series present token not match, theft assumed. user receives worded warning , of user's remembered sessions deleted.
- if username , series not present, login cookie ignored.
this approach provides defense-in-depth. if manages leak database table, not give attacker open door impersonating users.
Comments
Post a Comment