Remember Me – A Common Mistake


Hi,

Today I will be discussing common mistake I have seen new programmer does. You have observed often that there is a small Checkbox lying just below your Password field in most of the site. You often Check that box so that next time you visit that site you don’t need to get yourself logged in again.

I have seen programmer coding this with following Logic…

1) Check if User exists, If not raise an error.
2) If User exist but doesn’t have its password match in database, raise an error.
3) if all goes well and User has selected that little checkbox Make a Cookie and Allow login process… to goes on.

I guess that Logic is correct… Okay you are smart enough you get the error in the logic.

Yes, While raising error Programmer often forget to check the Little “check box” called remember me… What if he hasn’t select it, this means user doesn’t want his information to be store on this computer even a login failure occurs.
And if he doesn’t select it you need to clear Cookie if already exist.

That is what user indent most often.

So, next time you program a Remember Me feature thing twice it is not just a matter of setting cookie, it is a Programming logic.

Happy Coding
Sumit Gupta