NetTalk Central

Author Topic: Graceful notice of timed-out session?  (Read 3150 times)

Jane

  • Sr. Member
  • ****
  • Posts: 349
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Graceful notice of timed-out session?
« on: March 15, 2014, 02:30:20 PM »
Wise ones,

What's a graceful way to let a user know that his session has timed out?

My bank, for example, starts popping up "if you're idle for two more minutes you'll be logged off" messages.
Then bounces to a login page once they've killed the session.

For a site that doesn't require a login, I'd like to switch to a "need to reconnect" page when it's timed out. 
Otherwise people (such as me) try clicking buttons on the screen 20 minutes later and nothing happens.

Is there something in the NT examples showing this sort of thing... or a thread you can point me at?
Or a suggested approach?

TIA

Jane

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11171
    • View Profile
Re: Graceful notice of timed-out session?
« Reply #1 on: March 16, 2014, 11:28:24 PM »
If you wizard up a new footer procedure you'll see embed code in it something like this;

  if (p_web.GetSessionLoggedIn() and p_web.PageName <> p_web.site.LoginPage)
    ! parameter 1 is the session time
    ! parameter 2 is the name of the login page.
    ! parameter 3 is the id of the <div> in the html.
    p_web.Script('startCountDown('& int(p_web.site.SessionExpiryAfterHS/100) &',"'& clip(p_web.site.LoginPage) &'","countdown");')
  end


This shows a countdown in the footer - which can then re-direct a user to a page (in this case the login page).

Cheers
Bruce


Jane

  • Sr. Member
  • ****
  • Posts: 349
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Graceful notice of timed-out session?
« Reply #2 on: March 17, 2014, 08:09:37 PM »
Way cool. 

I'm not using a login for this app, but this gives me some good options.

Thanks, Bruce!

Jane

Alberto

  • Hero Member
  • *****
  • Posts: 1845
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Graceful notice of timed-out session?
« Reply #3 on: March 20, 2014, 09:33:31 AM »
How do I wizard up a new footer procedure ?
I'tried multiple ways but this code never happens
thanks
NT8

-----------
Regards
Alberto

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Graceful notice of timed-out session?
« Reply #4 on: March 30, 2014, 05:43:07 PM »
Hi Jane

Did you make progress with this?  I was going to ask the same question as in my application after a session has times out and a user tries to do something new then weird things happen and its not very graceful.

Cheers

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11171
    • View Profile
Re: Graceful notice of timed-out session?
« Reply #5 on: March 31, 2014, 06:54:31 AM »
>> How do I wizard up a new footer procedure ?

easiest is to wizard up a new app, based on say one of the example dictionaries, and just pinch it from there.

Keith, you'll find the code in there.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1845
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Graceful notice of timed-out session?
« Reply #6 on: March 31, 2014, 12:50:02 PM »
Cool, but ...
I´m using translate to translate the text and the footer does not respect the áéíóú
see image
Any idea?


[attachment deleted by admin]
-----------
Regards
Alberto

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Graceful notice of timed-out session?
« Reply #7 on: March 31, 2014, 10:47:50 PM »
Hi.
I see that it worked for Michelis but I wizarded up an app and after login nothing appears in the footer. Any settings I missed? see attached.
OK I see  the login screen is called after the timeout period but like Michelis I would like to display the time till logout.

[attachment deleted by admin]
« Last Edit: April 01, 2014, 01:31:24 AM by terryd »
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Alberto

  • Hero Member
  • *****
  • Posts: 1845
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Graceful notice of timed-out session?
« Reply #8 on: April 01, 2014, 02:30:21 AM »
terryd, there is a check in the wizard to do it, may be you missed it.

Anyway the result is very simple

Add this code ib the Proceced Code embed of the Footer proc:

[DEFINITION]
[SOURCE]
PROPERTY:BEGIN
PRIORITY 2500
PROPERTY:END
  if (p_web.GetSessionLoggedIn() and p_web.PageName <> p_web.site.LoginPage)
    ! parameter 1 is the session time
    ! parameter 2 is the name of the login page.
    ! parameter 3 is the id of the <div> in the html.
    p_web.Script('startCountDown('& int(p_web.site.SessionExpiryAfterHS/100) &',"'& clip(p_web.site.LoginPage) &'","countdown");')
  end

[END]

And go to the XHTML tab and add something like:

<div>Copyright <!-- Net:d:year --></div>
<div class="nt-right nt-countdown">Session Expires In:<div id="countdown"></div></div>

at Top, with condition= p_web.GetSessionLoggedIn()

And thats it.

Cheers
-----------
Regards
Alberto

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Graceful notice of timed-out session?
« Reply #9 on: April 01, 2014, 03:40:10 AM »
Thanks Michelis
Worked fine
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Alberto

  • Hero Member
  • *****
  • Posts: 1845
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Graceful notice of timed-out session?
« Reply #10 on: April 01, 2014, 05:56:34 AM »
Please Bruce Why is this happening?

I´m using translate to translate the text and the footer does not respect the áéíóú
see image
Any idea?



[attachment deleted by admin]
-----------
Regards
Alberto