Hi, I have this annoying popup window for Web Password whenever a click on a javascript action which require authentication. I have the problem for FF, IE and Chrome. The problem isn''t seen for non javascript action where the user gets redirected to the html login page. Ideally, I want even js to redirect there. Here is my access_denied. By the way, I tried removing the format.any(:xml,:js) completely and the page just don''t react when I click on JS. def access_denied respond_to do |format| format.html do flash.now[:alert]="You need to be logged in to perform that action." store_location redirect_to new_session_path end format.any(:xml,:js) do request_http_basic_authentication ''Web Password'' end end end Thanks, -- 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 -~----------~----~----~----~------~----~------~--~---
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org
2009-Mar-10 07:30 UTC
Re: Annoying pop up window with restful_authentication
On 10 Mar., 05:41, Youyou Semsem <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > I have this annoying popup window for Web Password whenever a click on a > javascript action which require authentication. I have the problem for > FF, IE and Chrome. The problem isn''t seen for non javascript action > where the user gets redirected to the html login page. Ideally, I want > even js to redirect there. Here is my access_denied. By the way, I tried > removing the format.any(:xml,:js) completely and the page just don''t > react when I click on JS. > > def access_denied<snip>> request_http_basic_authentication ''Web Password''<snip>> endThe #request_http_basic_authentication method prompts the user for a password. Maybe that is the "popup" you''re talking about. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Youyou Semsem
2009-Mar-10 13:21 UTC
Re: Annoying pop up window with restful_authentication
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org wrote:> On 10 Mar., 05:41, Youyou Semsem <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> Hi, >> I have this annoying popup window for Web Password whenever a click on a >> javascript action which require authentication. I have the problem for >> FF, IE and Chrome. The problem isn''t seen for non javascript action >> where the user gets redirected to the html login page. Ideally, I want >> even js to redirect there. Here is my access_denied. By the way, I tried >> removing the format.any(:xml,:js) completely and the page just don''t >> react when I click on JS. >> >> def access_denied > <snip> >> � � � � � request_http_basic_authentication ''Web Password'' > <snip> >> � � end > > The #request_http_basic_authentication method prompts the user for a > password. Maybe that is the "popup" you''re talking about.Yes I confirm that it is. When I remove it. Nothing happens when you click on a link_to_remote (js) -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org
2009-Mar-10 13:43 UTC
Re: Annoying pop up window with restful_authentication
On 10 Mar., 14:21, Youyou Semsem <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> ruby...-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org wrote: > > The #request_http_basic_authentication method prompts the user for a > > password. Maybe that is the "popup" you''re talking about. > > Yes I confirm that it is. When I remove it. Nothing happens when you > click on a link_to_remote (js)Then I guess it''s because the user is not authenticated. The method is called #access_denied, you know. Maybe you''re having problems with sessions or something similar. Do you have a #logged_in? method, and if yes, what does it return? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Youyou Semsem
2009-Mar-10 14:13 UTC
Re: Annoying pop up window with restful_authentication
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org wrote:> On 10 Mar., 14:21, Youyou Semsem <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> ruby...-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org wrote: >> > The #request_http_basic_authentication method prompts the user for a >> > password. Maybe that is the "popup" you''re talking about. >> >> Yes I confirm that it is. When I remove it. Nothing happens when you >> click on a link_to_remote (js) > > Then I guess it''s because the user is not authenticated. The method is > called #access_denied, you know. Maybe you''re having problems with > sessions or something similar. Do you have a #logged_in? method, and > if yes, what does it return?Thanks rubyguy. It''s expected that the user isn''t logged in. Let me summarize my problem. When the user clicks on a link_to (html) the redirection to the login page works fine. But when the user clicks on link_to_remote (js) the popup comes into play. Ideally i want the last case to redirect to the login page similar to html. Thanks, -- 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 -~----------~----~----~----~------~----~------~--~---
> Thanks rubyguy. It''s expected that the user isn''t logged in. Let me > summarize my problem. When the user clicks on a link_to (html) the > redirection to the login page works fine. But when the user clicks on > link_to_remote (js) the popup comes into play. Ideally i want the last > case to redirect to the login page similar to html.The way to do this is to have your authentication code return a json response code like {status: ''not logged in''}. Then your client side JS parses that and redirects if required. I may be wrong but I don''t know of an automatic way to do this. It would require a little work. SH -- Starr Horne My blog: http://starrhorne.com Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Youyou Semsem
2009-Mar-10 15:08 UTC
Re: Annoying pop up window with restful_authentication
Starr Horne wrote:>> Thanks rubyguy. It''s expected that the user isn''t logged in. Let me >> summarize my problem. When the user clicks on a link_to (html) the >> redirection to the login page works fine. But when the user clicks on >> link_to_remote (js) the popup comes into play. Ideally i want the last >> case to redirect to the login page similar to html. > > The way to do this is to have your authentication code return a json > response code like {status: ''not logged in''}. Then your client side JS > parses that and redirects if required. > > I may be wrong but I don''t know of an automatic way to do this. It would > require a little work. > > SH > -- > Starr Horne > My blog: http://starrhorne.com > Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/Thanks Starr. Can you please tell me how to do the json status? Is it something, that I put in the access_denied method? Should I just add this: {status: ''not logged in''}? -- 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 -~----------~----~----~----~------~----~------~--~---