Forum: Ruby on Rails "Remember Me" feature

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B06f6479558ba7218963e93797d2f928?d=identicon&s=25 Ben Knight (biguniverse)
on 2008-10-28 02:49
Posted by Ben Knight (biguniverse) on 28.10.2008 02:28
I realize this has probably been asked on these forums before but I
wanted to get the latest information on what's available.

We need to implement the typical "Remember Me" checkbox feature you find
for logins on various site.

What's the best way to do this in Rails 1.2.x and 2.x?  Should we use
cookies[] directly?  Or, can I use session[]?  We need this "remember
me" to be around for at least 2 weeks, maybe even forever (till they
logout).

Thanks.
6bf9328eef0afadd9c9d05334f8dd42b?d=identicon&s=25 Hubert Łępicki (Guest)
on 2008-10-28 08:24
(Received via mailing list)
Hi Ben,

I'm afraid you need to use cookies. But it's not that hard, really ;),
and is flexible enough. Please note you might not want to store any
sensitive information in cookie also, like username etc. in cleartext
- maybe setting up special purpose hash in user model, and storing it
also in cookie is good idea. You need also not to forget about
situation where user can use "remember me" on multiple computers -
otherwise your users will complain.

H.
55d6457963d5be7ad341343105ddc8a3?d=identicon&s=25 Nathan Esquenazi (xgamerx)
on 2008-10-28 10:10
A45f650cce5746dd89aafb3176b47b02?d=identicon&s=25 DyingToLearn (Guest)
on 2008-10-28 13:17
(Received via mailing list)
I always use Restful_Authentication (http://github.com/technoweenie/
restful-authentication). Even if you don't want to use that, I suggest
you take a look at how it handles it.

HTH
B06f6479558ba7218963e93797d2f928?d=identicon&s=25 Ben Knight (biguniverse)
on 2008-10-29 19:25
Thanks everyone.
This topic is locked and can not be replied to.