NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on September 15, 2017, 12:39:57 PM

Title: Form and User must be logged in problem
Post by: Alberto on September 15, 2017, 12:39:57 PM
Suppouse the user is in a Form editin a record

http://127.0.0.1:88/uImage

It goes out for lunch and the server disconnects it.

When it returns and refreshes the page the server sends it to the login page... thats ok... but when it logs in again it is redirected to the form page with all data blanked which is not ok, user confusing which besides can click on the save button, etc

Any way of having an option in the form template to set where to redirect when logged out?
Or any way to avoid it?

Thanks
Title: Re: Form and User must be logged in problem
Post by: Bruce on September 17, 2017, 11:35:23 PM
Hi Alberto,

The best way to avoid this is to automatically redirect the page to a "session ended" type page (or back to the home page) when the session ends.

If you wizard up a new app, you'll find some code in the footer which does this. The code looks 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 page where the user will go when the session ends.
    ! 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


the <div> in the 3rd parameter refers to a way to show the user the time left in the session. For example;

<div class="nt-right nt-countdown">Session Expires In:<<div id="countdown"><</div><</div>

cheers
Bruce