tardate
2008-Jul-12 22:31 UTC
Re: Re[Rails] stful_authentication, Internet Explorer, and unwanted http basic dialog
I''m glad I found your post Joshua - it saved me quite a bit of time! To get this to work for me however (IE6), I had to ditch the ||= and do straight assignment: request.format = :html if request.env[''HTTP_USER_AGENT''] =~ /msie/i Joshua Doss wrote:> > > Alter access_denied to add this line (right below "def access_denied"): > > request.format ||= :html if request.env[''HTTP_USER_AGENT''] =~ /msie/i > > It''s a quick hack but it seems to work fine so far for me. The > problem is, as you''ve stated, IE doesn''t seem to send the right accept > headers (if any) when fetching a URL without an explicit extension in > the URL. For instance if you have a /users/4 URL, it will bring up > the basic authentication dialog, but /users/4.html will correctly > redirect to new_session_path. > > -J. > > On Jun 26, 2008, at 11:53 PM, Chris Bartlett wrote: > >> >> The issue is in this method of authenticated_system.rb: >> >> def access_denied >> respond_to do |format| >> format.html do >> store_location >> redirect_to new_session_path >> end >> format.any do >> request_http_basic_authentication ''Web Password'' >> end >> end >> end >> >> For some reason Internet Explorer is falling through to format.any - >> something''s not quite working with its accept headers, it seems. >> Compare: >> http://rituonrails.wordpress.com/2006/12/10/strane-behaviour-of-respond_to-in-ie/ >> >> On Jun 27, 2:58 pm, Chris Bartlett <c.bartl...-wUU9E3n5/m4qAMOr+u8IRA@public.gmane.org> wrote: >>> I have a fairly bog-standard installation of restful_authentication >>> and run my app in Rails 2.1. Internet Explorer 6 and 7 are popping up >>> an http basic authentication dialog instead of doing what all other >>> browsers do: go to the login page. Any thoughts why? >>> >>> I''ve modified the following method of authenticated_system.rb, but >>> there''s no difference before or after. >>> >>> Before: >>> >>> def current_user >>> @current_user ||= (login_from_session || login_from_basic_auth || >>> login_from_cookie) unless @current_user == false >>> end >>> >>> After: >>> >>> def current_user >>> @current_user ||= login_from_session unless @current_user == >>> false >>> end >>> >>> Thanks for any help. >> > > > > > > >-- View this message in context: http://www.nabble.com/Restful_authentication%2C-Internet-Explorer%2C-and-unwanted-http-basic--dialog-tp18147300p18398601.html Sent from the RubyOnRails Users mailing list archive at Nabble.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 -~----------~----~----~----~------~----~------~--~---
Fernando Perez
2008-Jul-13 10:06 UTC
Re: Re[Rails] stful_authentication, Internet Explorer, and u
Too funny, I also run into this problem this week. Only IE7 is crapping out. I solved this problem by overwriting the access_denied method, by removing the http_basic_auth option which I don''t use. -- 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 -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- Where can I get "authenticate_with_http_basic"?
- Restore password without session initialized
- Facebooker and existing website?
- Help with error - uninitialized constant AuthenticatedSystem::Base64
- Modifying the restful_authentication plugin / Classes creating instances of themselves.