security.logout(); modal dialog in webclient

Hi,

In our solution we present to the user a logout label that he can click, to logout from the application. On the action of the logout label we call security.logout();

When he made changes and then press the logout button we ask him in a modal dialog whether he want to save or not. We open the dialog using application.showFormInDialog();

But in the WebClient, although before calling the security.logout(); we also call application.closeFormDialog(); to close the modal dialog, that dialog will never go away, unless the user close the browser completely.

Any suggestion how the dialog can be closed before the logout?

Thanks,
Bogdan.

Where do you redirect after security.logout ? What is displayed in the modal dialog after logout ?

Hi,

You can see in the below images. I press logout, it asks me to save. I choose NO. The only thing I do is to call security.logout(); I do nothing else!
[attachment=2]Screen shot 2011-07-08 at 11.44.42 AM.png[/attachment]
[attachment=1]Screen shot 2011-07-08 at 11.45.13 AM.png[/attachment]

Then I refresh the browser and I get this. The save window can’t be closed at all!
[attachment=0]Screen shot 2011-07-08 at 11.45.38 AM.png[/attachment]

How can I redirect to the login screen when user press logout?

Thanks,
Bogdan.

We had this issue in the past also, I thought it was fixed. If you can reproduce this in a small sample please open a case with this.

which version of servoy are we talking about here?
I did make a fix in 6 for this. That will be in RC3

Hi,

Servoy version 5.2.9 -build 1020

We didn’t updated yet to v6.

Is it safe to update our online server to v6 while is it only a RC and not a release?

Thanks,
Bogdan.

that code should work in 5.2 as far as i know, there was a regression that in 6 we had that behavior back that when you close/logout a solution when in side a dialog it did close it there.

Much better is to use application.showUrl(url) or , application.showUrl(url,“_top”)

to use application.showUrl(url) instead of security.logout() ? but the client will be logged out in this case?

no see also the doc of logout or closesolution

do a showUrl first and then a logout/close

Hi,

I’m doing this now, but I tested local on Windows(Chrome) and doesn’t work. Online, at least for me it worked on Windows(Chrome,Mozilla), but didn’t work on Windows(IE), Mac(Chrome,Safari).

function gotoLogout(event) {
	var host = globals.getPreferencesFoundSet().server_host;

	if (application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT) {
		application.showURL("http://" + host + "/webclient.html", "_self");
	}

	security.logout();
	application.closeSolution();
}

Before calling the above method I also call, to make sure that the modal dialog will close, but it doesn’t:

application.closeFormDialog();

[attachment=0]savebox.PNG[/attachment]

why are you using “_self” and not what i said “_top” or nothing?

Because if I use “_top” or nothing it will open the login solution in a popup and the old page will remain as it is. If I use “_self”, after logout it will redirect in the same page to the login solution, and this is what we want.

thats weird that shouldn’t happen, “_top” should result in the current window that then the top is replaced with the url that you want.
I made a quick test in 6:

application.createWindow("test",JSWindow.MODAL_DIALOG).show("orders");

that opens a form in dialog

then this:

application.showURL("http://localhost:8080/servoy-webclient/", "_top");
	application.closeSolution();

is run inside the modal dialog when pressing a button and this closes the modal dialog, and sets the browser to open in that tab the url given.

I open the modal dialog with the question using

application.showFormInDialog();

Can this be the problem?

no thats just the 5.2 way

i just tested in 5.2 and calling this:

application.showURL(“http://localhost:8080/servoy-webclient/”, “_top”);
application.exit();

in a button click that is shown in a modal dialog like this:

application.showFormInDialog(forms.orders_indialog,“test”,true);

works fine for me.

I’ll try, but after the application.exit(); ill go to the login screen?

no in my example it will go the the standard choose solution url of servoy.

Many thanks! It finally works! :D

I disabled the servoy.allowSolutionBrowsing and it also jumps directly to the login screen!

for the webclient I do this now

application.showURL("http://" + host + "/webclient.html", "_top");
application.exit();

:

and for the SmartClient I do this. it might work also without the first 2 lines, but at least I had to put the solution name in the logout method, otherwise I get and exception and the app hangs: “cannot open solution”.

elements.tabsMain.removeAllTabs();
application.closeForm();
security.logout("AeroPlus");

Thanks again!

Hi,

I used
application.closeFormDialog(forms.gracias)
application.showURL(‘http://www.prorm.com’, ‘_top’);
application.exit();

And receive
Page Expired

The page you requested has expired.

But then tried with

//application.closeFormDialog(forms.gracias)
application.showURL(‘http://www.prorm.com’, ‘_top’);
application.exit();

and worked fine.

Regards,