Remember_me_for in authlogic

Hi
I am new to using authlogic . My requirement is in Login page I
have a check box which says “Keep me logged in for 2 weeks” . But I
dont know how to implement this. I have just seen remember_me_for in
the doc. But did not understand how to use it. Could anyone please give
an
example to use this?

Thanks in advance
Tom

Hi,

me too have the same problem could someone help us.

Thanks in advance
Amal

it’s ‘remember_me’.

You’ve have to create a checkbox for this value:

in your erb:

<% form_for @user_session do |f| %>
<% f.checkbox :remember_me, “Remember me” %>
<% end %>

Hi
Thanks for the reply. What you said is right And from the doc what I
understood is it sets remember_me default as 3.months. But how can we
modify that? That is my question. What I need is when user check
remember_me check box from view time should be set to 2 weeks (say 2
minutes as an example) I tried like

class UserSession < Authlogic::Session::Base
remember_me_for 2.minutes
end

But this did not work. Even after 2 minutes user session persisted

Tom

class UserSession < Authlogic::Session::Base

def remember_me_for
2.minutes
end

end

Next, I would recommend looking at your cookies to verify that session
cookie is properly created and expired.

Good luck,

-Conrad

Hi Conrad

Thanks. It perfectly worked

Tom

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs