Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: js_vaughanPosted on 2009-02-12 at 07:52:23ID: 23623143
First off, you dont need to save your password. Your correctly have your cookies set only after the password has been confirmed, so you know cookies will only come from someone who already knows it. For security purposes, do not save the password as a cookie - you dont need to - email is enough.
My second suggestion is to add an additional cookie AND database field to hold a date-time value. Assign now() to a variable then distribute something like this :
<cfset myTimeVar="#now()#">
<cfcookie name="cookieTime" value="#myTimeVar#" expires="never">
<!--- insert myTimeVar to the database as well --->
This cookieTime will prevent the "remember me" from allowing unlimited access from multiple computers. This, i believe, is extremely important in case a user accidentally clicks remember me from a public computer. Example: User logs in at home when they wake up. COOKIE.cookieTime and the DB timestamp are both set at Jan 1st 10am. The next day User goes to a public computer, clicks remember me, so now the public COOKIE.cookieTime is set and the DB timestamp is overridden to Jan 2nd 1pm. When user returns home and tries to login later that day, their COOKIE.cookietime still says Jan 1st 10am, but the database holds Jan 2nd 1pm (created from their time out in public) Access is denied. But no worry, user logs in again, clicks the remember me... and now his local cookie will say Jan 2nd 7pm and the DB timestamp is overwritted to hold the new Jan 2nd 7pm as well. That potential security threat is gone because the public computer's cookie will say Jan 2nd 1pm, but the database will say Jan 2nd 7pm. The public computer is no longer in sync and will not be able to reconnect. Meanwhile, the user goes to sleep, wakes up, goes to their computer on Jan 3rd... and both their cookie and DB timestamp will still be set to Jan 2nd 7pm... access is granted.
The final piece of the puzzle: how to handle the login. I would recommend your application.cfc/cfm hold code similar to this ....
Select allOpen in new window