Possible Duplicate:
What is the best way to implement “remember me” for a website?
Every user has unique 32 chars id (made of like this: md5("salt" . $username . $user_password . "salt2");
). And I store this value under 'unique_id' field in table users. Is it a good way to assign this value to user's cookie and let him be logged in only if he has it assigned? And of course check it if that value exists in database?
I don't think it's a a good practise, because if someone steals your cookie, they will be able to log in to your account.
What's the other/better solution? Of course the safest thing is probably just to store it in sessions, but I want to implement this remember me feature.
Thanks.
Clicking the “Remember Me” box tells the browser to save a cookie so that if you close out the window for the site without signing out, the next time you go back, you will be signed back in automatically. Make sure that you have your browser set to remember cookies, or this function will not work.
removeItem('Longtail-User'); } catch (error) { // Error removing }}; 5. Last on componentDidMount (will run once when app loads) trigger function to check if a username exists and update state of username. This is all you need to add a Remember me functionality to your React Native app.
Say database table's name for persistent cookie is pcookies with the following columns:
Cookie creation steps:
Authentication steps:
Notes:
These two posts provide excellent implementation guidelines for persistent login cookies:
(Read them in the given order, since the second one improves the first one.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With