security.logout(); modal dialog in webclient

Forum to discuss the Web client version of Servoy.

security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Fri Jul 08, 2011 9:21 am

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.
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby lvostinar » Fri Jul 08, 2011 10:29 am

Where do you redirect after security.logout ? What is displayed in the modal dialog after logout ?
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Fri Jul 08, 2011 10:57 am

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!
Screen shot 2011-07-08 at 11.44.42 AM.png

Screen shot 2011-07-08 at 11.45.13 AM.png


Then I refresh the browser and I get this. The save window can't be closed at all!
Screen shot 2011-07-08 at 11.45.38 AM.png


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

Thanks,
Bogdan.
You do not have the required permissions to view the files attached to this post.
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby lvostinar » Fri Jul 08, 2011 11:18 am

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.
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Mon Jul 11, 2011 2:15 pm

which version of servoy are we talking about here?
I did make a fix in 6 for this. That will be in RC3
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Mon Jul 11, 2011 2:20 pm

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.
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Mon Jul 11, 2011 2:35 pm

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")
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Mon Jul 11, 2011 2:38 pm

to use application.showUrl(url) instead of security.logout() ? but the client will be logged out in this case?
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Mon Jul 11, 2011 2:42 pm

no see also the doc of logout or closesolution

do a showUrl first and then a logout/close
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Mon Jul 11, 2011 7:53 pm

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).

Code: Select all
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:
Code: Select all
application.closeFormDialog();


savebox.PNG
You do not have the required permissions to view the files attached to this post.
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Tue Jul 12, 2011 9:54 am

why are you using "_self" and not what i said "_top" or nothing?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Tue Jul 12, 2011 9:57 am

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.
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Tue Jul 12, 2011 3:10 pm

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:

Code: Select all
application.createWindow("test",JSWindow.MODAL_DIALOG).show("orders");


that opens a form in dialog

then this:

Code: Select all
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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: security.logout(); modal dialog in webclient

Postby udrescu_bogdan » Tue Jul 12, 2011 3:19 pm

I open the modal dialog with the question using

Code: Select all
application.showFormInDialog();


Can this be the problem?
udrescu_bogdan
 
Posts: 336
Joined: Fri Jun 18, 2010 3:27 pm
Location: Craiova, Romania

Re: security.logout(); modal dialog in webclient

Postby jcompagner » Tue Jul 12, 2011 3:43 pm

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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Next

Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 4 guests

cron