I am trying to implement an automatic logout for an online application I
am building. The idea is that after an hour of inactivity to have the
page autmoatically logout itself. The main part of my code is as
follows:
if !session[:expire][:expires].blank?
@time_left = (session[:expire][:expires] - Time.now).to_i
else
@time_left = 0
end
if @time_left.to_i <= 0
flash[:notice] = "<b style = color: red;>You have been logged out
due
to
inactivity</b>"
session[:expire] = nil
redirect_to :action => ''login'' and return
else
redirect_to :action => pattern, :id => params[:id], :from_expiry=>
"true"
end
However, when the code get to the if statement that redirects the page
to the login page, it enters the if but fails to redirect the page and
it doesn''t seemt o be throwing any errors. Any idead on how to get this
to work? 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
-~----------~----~----~----~------~----~------~--~---
I should also mention the periodic call function that is used to check
is the session time has expired:
<%= periodically_call_remote :update => ''content'', :url
=> {:action =>
''session_expiry'', :id => @user.id, :manager =>
@manager.blank? ? '''' :
@manager.id, :controller => ''enroll'' }, :frequency =>
''60'' %>
One thing that I noted in the logs is this line when I try and render
the login page after time expires:
Rendering layoutfalse within layouts/simple
This is different then the other pages that I render:
Rendering layoutfalse within layouts/simple
Everything seems to work other then the fact that the page is not render
after the periodic_call and time expires. THanks again,
-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
-~----------~----~----~----~------~----~------~--~---
> Everything seems to work other then the fact that the page is not render > after the periodic_call and time expires. THanks again, >Doing a redirect from an ajax request won''t do what you think it does. You have to use rjs and use the rjs redirect_to. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---