NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Jane on March 15, 2014, 02:30:20 PM

Title: Graceful notice of timed-out session?
Post by: Jane 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
Title: Re: Graceful notice of timed-out session?
Post by: Bruce 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

Title: Re: Graceful notice of timed-out session?
Post by: Jane 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
Title: Re: Graceful notice of timed-out session?
Post by: Alberto 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

Title: Re: Graceful notice of timed-out session?
Post by: Keith 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
Title: Re: Graceful notice of timed-out session?
Post by: Bruce 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
Title: Re: Graceful notice of timed-out session?
Post by: Alberto 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]
Title: Re: Graceful notice of timed-out session?
Post by: terryd 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]
Title: Re: Graceful notice of timed-out session?
Post by: Alberto 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
Title: Re: Graceful notice of timed-out session?
Post by: terryd on April 01, 2014, 03:40:10 AM
Thanks Michelis
Worked fine
Title: Re: Graceful notice of timed-out session?
Post by: Alberto 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]