honey ruby
2012-May-10 06:54 UTC
how to prevent the user from accessing the app.after logout with back button(rails only)
hi all after logging out of my site if i click back button it is going back to my app. how can i restrict this problem i have use before_filter also. thanks in advance -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2012-May-10 07:23 UTC
Re: how to prevent the user from accessing the app.after logout with back button(rails only)
On 10 May 2012 07:54, honey ruby <emailtohoneyruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> after logging out of my site if i click back button it is going back > how can i restrict this problemIt''s a browser caching issue, so you need to tell the browser not to cache. http://stackoverflow.com/questions/711418/how-to-prevent-browser-page-caching-in-rails -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hanish jadala
2012-May-10 07:46 UTC
Re: how to prevent the user from accessing the app.after logout with back button(rails only)
thanks for your reply i have added your code and i checked it. if i click back button after logout it is still going back to app but it is give me the error " undefined method `username'' for nil:NilClass" it shows it going back to app. On Thu, May 10, 2012 at 12:53 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10 May 2012 07:54, honey ruby <emailtohoneyruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > after logging out of my site if i click back button it is going back > > how can i restrict this problem > > It''s a browser caching issue, so you need to tell the browser not to cache. > > > http://stackoverflow.com/questions/711418/how-to-prevent-browser-page-caching-in-rails > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2012-May-10 07:52 UTC
Re: how to prevent the user from accessing the app.after logout with back button(rails only)
On 10 May 2012 08:46, hanish jadala <emailtohoneyruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> thanks for your reply i have added your code and i checked it. if i click > back button after logout it is still going back to app but it is give me the > error " > > undefined method `username'' for nil:NilClass" it shows it going back to app.It''s not "my code" - it''s sample code from the Internet. Your error is now in your code - probably in the handling of controller actions when users are not logged in. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
javinto
2012-May-10 19:02 UTC
Re: how to prevent the user from accessing the app.after logout with back button(rails only)
Several solutions in the before mentioned post were suggested. I used: before_filter :set_cache_buster def set_cache_buster response.headers["Cache-Control"] = "no-cache, no-store, max- age=0, must-revalidate" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" end I''m using Devise for authentication. All works like a charm. On 10 mei, 09:52, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10 May 2012 08:46, hanish jadala <emailtohoneyr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > thanks for your reply i have added your code and i checked it. if i click > > back button after logout it is still going back to app but it is give me the > > error " > > > undefined method `username'' for nil:NilClass" it shows it going back to app. > > It''s not "my code" - it''s sample code from the Internet. > Your error is now in your code - probably in the handling of > controller actions when users are not logged in.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.