I am using the following for to peroidically call back to the control to
see if a certain amount of time has passed:
in .rhtml
<%= periodically_call_remote :url => {
:action => ‘session_expiry’ },
:update => ‘’ %>
in controller
if !session[:expire].blank?
@time_left = (session[:expire][:expires] - Time.now).to_i
else
@time_left = 0
end
if @time_left.to_i < 0 or @time_left == 0
flash[:notice] = “You have been logged out
due
to inactivity”
session[:user] = nil
redirect_to :action => ‘login’
end
The idea being that if too much time has passed the user gets signed out
and get kicked back to the login page. Everything work right, except the
bit of code that check to see if an hour has passed since the users last
action and then it is supposed to redirect_to a login form. The problem
is that when it gets to that redirect_to it seems to skip right over it
and not do anything, even worse, it allows the user to continue to be
logged in. Has anyone used peroidically_call_remote before and has
similar issues and how did you fix them? Thanks,
-S