Auto-logout after 15 minutes....

Hi There,

Im going through the ruby on rails tutorial 'Railsspace' at the moment.

There is a :remember_me function that allows a cookie to be set at login to remember the user. See below:

if @user.remember_me == "1"             cookies[:remember_me] = { :value => "cookie name",             :expires => 2.minutes.from_now }             user.authorization_token = Digest::SHA1.hexdigest(             "#{user.username}:             #{user.password}")!             cookies[:authorization_token] = {                     :value => user.authorization_token,                     :expires => 2.minutes.from_now }               else                   cookies.delete(:remember_me)                   cookies.delete(:authorization_token)

When i look in safari's preferences, I can see that the cookie is set. Agfter the 2 mins, I refresh the web page, and....

- Safari removes the cookies, but the user still looks logged in.

Is there a way to amend this to ensure that say, after 15 mins, the user is automatically logged out.

Can anyone help?

Many Thanks


Use the “session-timeout” plugin.


session_times_out_in 15.minutes, :after_timeout => :do_something

Good luck.