Tab close or browser close should logout the system.

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Tab close or browser close should logout the system.

Postby satya.sahu » Thu Sep 08, 2016 7:03 am

Hi

I am using servoy 7.4.1(web client).
Is there any way is there when user close the tab or close the browser then it should log out the solution ?
Or Is there any way when the user close the tab or browser, then next time user click on new tab or new browser and type the url then it should log out the solution instead of loading the previous session.

Thanks,
Satya
satya.sahu
 
Posts: 33
Joined: Thu Aug 29, 2013 4:59 pm
Location: India

Re: Tab close or browser close should logout the system.

Postby Bernd.N » Thu Sep 08, 2016 8:44 am

Hi Satya,
though I have no answer for your question, I recommend a supporting measure to ask users to always logout properly.

You could use a flag that gets set when a user logs in, and gets null when the user logs out as she should.
Then on login, you can show a message to ask the user to always use the proper way to logout.
Additionally, you could set a counter to detect those users who ignore this constantly. :wink:

This is the code we use on login.
In your logout method, you just set the flag then to null, so the flag would stay for users that do not use your intended logout button.
Code: Select all
      if (_to_person$currentpersonid.ps_did_not_logout_properly === 1) {
      
         // Count up
         _to_person$currentpersonid.ps_did_not_logout_properly_num += 1;
         
         scopes.ui.getDialog("ps_please_use_logout");
      }
      
      _to_person$currentpersonid.ps_did_not_logout_properly = 1;

Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 544
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Tab close or browser close should logout the system.

Postby sbutler » Thu Sep 08, 2016 9:52 pm

Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Tab close or browser close should logout the system.

Postby satya.sahu » Fri Nov 04, 2016 9:26 am

Thanks for the reply

But My requirement is like when i close the tab or close the browser it should log out the system. I am using the following JQuery code but its not working.
' $(window).on("unload",function() {' +
plugins.WebClientUtils.generateCallbackScript(scopes.navigation.runMenuHandlerServoy, ["logout"]) +
'});'
The method scopes.navigation.runMenuHandlerServoy keeps the logout logic. Any way when I am closing the tab its not calling that method as well its not log out the user, The problem is that when user type the same url its loading previous session data and solution is not working properly.

Thanks
Satya
satya.sahu
 
Posts: 33
Joined: Thu Aug 29, 2013 4:59 pm
Location: India

Re: Tab close or browser close should logout the system.

Postby Gordon McLean » Fri Nov 04, 2016 10:09 am

satya.sahu wrote:Hi

I am using servoy 7.4.1(web client).
Is there any way is there when user close the tab or close the browser then it should log out the solution ?
Or Is there any way when the user close the tab or browser, then next time user click on new tab or new browser and type the url then it should log out the solution instead of loading the previous session.

Thanks,
Satya


This is a long overdue feature that Servoy Webclient prevents by the very nature of the way it works, constantly poling the server. What would be idea is a plugin or function that allowed the developer to set the time out for inaction on the page and take the user back to login or a friendly reminder page. It both sucks up client licenses that could otherwise be used for new users and makes the page unresponsive when/if the user does return whilst it reconnects. As for educating users to log out this is a nice idea but in practice just does not work.
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 253
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: Tab close or browser close should logout the system.

Postby satya.sahu » Sat Nov 05, 2016 9:58 am

Any help from Servoy forum?
satya.sahu
 
Posts: 33
Joined: Thu Aug 29, 2013 4:59 pm
Location: India

Re: Tab close or browser close should logout the system.

Postby rgansevles » Sat Nov 05, 2016 1:20 pm

Hi,

Not directly answering the question, but fyi, this is a feature built-in for the ng-client (Servoy 8).

When the user closes the browser tab (or navigates to another url in the same tab), the ng-client will be closed after a small period.
When the user returns to the page within this period, the session will be reconnected, and the user continues where it was.
This allows for resilience in case of short network outages.

The period is 60 seconds by default and can be configured via setting sablo.window.timeout.secs on the admin page, see https://wiki.servoy.com/display/DOCS/NG+Client+Settings

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Tab close or browser close should logout the system.

Postby pbakker » Mon Nov 07, 2016 12:46 pm

Rob,

The link you point to is not publicly available.

Secondly: is there a way to disable this timeout from within a NGClient sessions, because this behavior is problematic when for example you (temporarily) redirect the user to another website, for example for oAuth authentication. The 60 seconds interval is too short

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: Tab close or browser close should logout the system.

Postby rgansevles » Tue Nov 08, 2016 12:59 am

Hey Paul,

I expected the page to be published, I asked Johan to fix this.
Thanks for that.

The window timeout is a static setting now, but I think it could be made overridable, for instance via application.putClientProperty().
When you file a request it will be looked at.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Tab close or browser close should logout the system.

Postby pbakker » Tue Nov 08, 2016 9:59 am

pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 5 guests

cron