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] = "<b style = ''color: red;''>You have been logged out due to inactivity</b>" 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 28, 9:27 pm, Shandy Nantz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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,This has nothing to do with periodically_call_remote and everything to do with it being an ajax request. If you want to redirect from an ajax request you need to use rjs (ie remove the update option from periodically_call_remote) and use page.redirect_to from the rjs Fred> > -S > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> > This has nothing to do with periodically_call_remote and everything to > do with it being an ajax request. > If you want to redirect from an ajax request you need to use rjs (ie > remove the update option from periodically_call_remote) and use > page.redirect_to from the rjs > > FredThat fixed it, thanks, -S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---