[ovirt-devel] 回复: In windows OS & firefox brower, Window.Location.replace(url) would stop System to execute Command, and would not catch any error info.But other OS like firefox in linux would not happen like that

Vojtech Szocs vszocs at redhat.com
Mon Nov 23 11:57:15 UTC 2015


Hi,

another way to solve this, without modifying oVirt WebAdmin sources,
is to write a small UI plugin that performs the redirect within its
UserLogout callback:

  var api = parent.pluginApi('ExampleRedirectOnLogoutPlugin');
  api.register({
    UserLogout: function() { window.location.assign('http://www.example.org'); }
  });
  api.ready();

Reference documentation: http://www.ovirt.org/Features/UIPlugins

Regards,
Vojtech


----- Original Message -----
> From: "温蓓" <wenbei_43409338 at qq.com>
> To: "awels" <awels at redhat.com>, "devel" <devel at ovirt.org>
> Sent: Friday, November 13, 2015 3:34:27 AM
> Subject: [ovirt-devel] 回复:  In windows OS & firefox brower, Window.Location.replace(url) would stop System to execute
> Command, and would not catch any error info.But other OS like firefox in linux would not happen like that
> 
> Hi Alexander
> I tried your method ,and it works! right, I want to redirect another page
> after user logged out, but also I want Ovirt-engine could execute Logout
> user command to clear session.
> I tried to insert Window.Location.replrace in LoginModel.java ,
> ApplicationPlaceManager.java etc. In any version firefox of window7 OS, even
> if another page could be redirected correctly ,ovirt-engine would not
> execute Logout user command ,so user's session would not be clear, and I can
> see previous page.
> It's strange that this stuff would not happen in other browsers(chrome/IE),
> even the firefox of Linux. I try to replace in callback() as your advice,
> now, for every browsers, ovirt-engine can execute logout command, it works!
> Thank you so much for your patience :)
> 
> 
> ------------------ 原始邮件 ------------------
> 发件人: "Alexander Wels"<awels at redhat.com>;
> 发送时间: 2015年11月12日(星期四) 晚上10:37
> 收件人: "devel"<devel at ovirt.org>;
> 抄送: "温蓓"<wenbei_43409338 at qq.com>;
> 主题: Re: [ovirt-devel] In windows OS & firefox brower,
> Window.Location.replace(url) would stop System to execute Command, and would
> not catch any error info.But other OS like firefox in linux would not happen
> like that
> 
> On Thursday, November 12, 2015 01:41:38 PM 温蓓 wrote:
> > HiI want to redirct the page when ovirt admin logout, so I add
> > :Window.Location.replace("/test.html") in ApplicationPlaceManager.java as
> > below:
> > @Override
> > public void revealDefaultPlace() {
> > PlaceRequest pr = getDefaultPlace();
> > if (pr == null) {
> > //Window.Location.replace("/test.html"); //$NON-NLS-1$
> > } else {
> > revealPlace(pr);
> > }
> > } or in
> > LoginModel.java\BaseApplicationInit.java etc. It can achieve to redirect by
> > chrome,IE and firefox in Linux, and would execute LogoutUserCommand to
> > clean user session,Then at firefox in Windows no matter which version, it
> > could redirect but would not execute LogoutUserCommand, so I can log into
> > System by previous URL without password. How can I redirect URL when
> > logout?Is there any config files for this? I could not find it, thanks a
> > lot :) Version-Release number of selected component (if applicable): 3.4.5
> > Steps to Reproduce: 1.update code:ApplicationPlaceManager.java public void
> > revealDefaultPlace() { PlaceRequest pr = getDefaultPlace();
> > if (pr == null) { //Window.Location.replace("/test.html");
> > //$NON-NLS-1$ } else { revealPlace(pr); } }
> > 2.login system and logout 3.input previous url like
> > :xxxxxx/ovirt-engine/webadmin/?locale=zh_CN#vms and can redirect. Actual
> > results: redirect into vm page. Expected results: redirect into login page.
> 
> Hi,
> 
> I am trying to decipher your message (it got garbled for some reason). And I
> am trying to understand what you are trying to do. If I understand correctly
> you want to redirect to some other page after you have logged out of the web
> admin.
> 
> To get back to the specifics of your question. The DefaultPlace is the #XXX
> in
> the URL you are sent to (note its not an actual redirect, since there is no
> round trip to the server), if you don't specify a particular place. When you
> do #vms the whole DefaultPlace mechanism is not in play since you specified a
> particular place.
> 
> What does happen is that the framework asks the LoggedInGatekeeper if the
> user
> is logged in (in the canReveal() method). If the user is logged in, it will
> proceed to the normal place requested (in your example #vms). If the user is
> not logged in, it will switch places to #login and display the login screen.
> 
> Now you say you are using 3.4.5 which is quite old, and its been some time
> since I worked with it. If I understand correctly what you are trying to do,
> don't mess around with the DefaultPlace. In BaseApplicationInit there should
> be a 'onLogout' method. In there should be a callback that happens AFTER the
> user is logged out from the server. Right now it says something
> Window.Location.reload() to reload the page after the logout. You should be
> able to put your Window.Location.replace in there (replace the reload with
> the
> replace). Which I think will do what you want.
> 
> If it doesn't do what you want, I am going to need some more information on
> what it is that you are trying to do.
> 
> Alexander
> 
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel



More information about the Devel mailing list