NetTalk Central

Author Topic: PageFooter Session Manager issue  (Read 5985 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
PageFooter Session Manager issue
« on: June 11, 2024, 10:55:38 AM »
Hi,
session manager set in the pagefooter to go to the IndexPage
server timeout, lets say, set to 00:30
The user logs in and go to a browse, the session timer runs ok
If the user change the browser tab, the timer of the initial tab stops running or runs slow,
so, all the time the user is in another tab is not discounted from the session timer
But this does not happen to the internal delete session process timer
So the session is deleted by the server before the session manager timer reachs 0
And when the user goes to the initial tab, the last page is still there, the timer shows it left 00:15, but its session is deleted,
then when the user clicks on any control
It is redirect to the Login Page instead of the IndexPage
And this cause problems like...
If the user logs in again, its redirect to the last browse, the user clicks on change and the form appears all blanked.

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

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: PageFooter Session Manager issue
« Reply #1 on: June 12, 2024, 11:04:11 AM »
I'm also interested in a workaround for this.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PageFooter Session Manager issue
« Reply #2 on: June 13, 2024, 06:43:08 AM »
noted.

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: PageFooter Session Manager issue
« Reply #3 on: June 13, 2024, 08:18:39 PM »
I haven't grokked the nt-session timer countDown method.  But it appears (?) to be subtracting from a counter variable: this.state.timeLeft -= 1

This guy suggests a different approach using a counter based on epoch time: https://abhi9bakshi.medium.com/why-javascript-timer-is-unreliable-and-how-can-you-fix-it-9ff5e6d34ee0

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PageFooter Session Manager issue
« Reply #4 on: June 14, 2024, 04:06:05 AM »
THis, Jane, is a grate idea! thanks
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PageFooter Session Manager issue
« Reply #5 on: June 14, 2024, 04:36:58 AM »
>> But it appears (?) to be subtracting from a counter variable: this.state.timeLeft -= 1

correct. It's incorrectly assuming that the timer is running once per second, but it's obviously running slow.
It should query the local time to determine time elapsed, not just reduce it by a second.
I'll tweak it for the next build.


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PageFooter Session Manager issue
« Reply #6 on: June 14, 2024, 05:06:27 AM »
Beware that...
suppouse the session timeout works ok and it fires at the same time as the deletesession
If the timeout is reached
and the user is on another tab when it happens
what happens if the session manager expire/continue messsage is active?
the activate option should not be possible because the session is deleted
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PageFooter Session Manager issue
« Reply #7 on: June 14, 2024, 06:40:37 AM »
updated js file attached.
Will be in the 14.24 build.

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PageFooter Session Manager issue
« Reply #8 on: June 14, 2024, 07:06:37 AM »
TEsted, session manager and timer work ok but the session is not disconected anymore.
Session manager goes to the defaultpage, click to login, all session values are intact, still logged in.
« Last Edit: June 14, 2024, 07:10:04 AM by Alberto »
-----------
Regards
Alberto

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: PageFooter Session Manager issue
« Reply #9 on: June 14, 2024, 09:11:49 AM »
>  but the session is not disconected anymore

I have not tested the new js yet.

But what I've been doing anyway in session manager template tab:

for Go to URL I have
'IndexPage?logout=1'

Then in PageHeaderTag, I have the following (my code in red)

  ! Start of "Before DivHeader"
  ! [Priority 2700]
 
  ! Secwin - Set SecurityAccess for the menu
    If p_web.Event = 'getsecwinsettings'   !NetTalk Web Menu
      GlobalErrors.SetProcedureName()
      Return
    end
  ! [Priority 7700]
    IF p_web.GetValue('logout') = 1
      p_web.SetSessionLoggedIn(0)
      p_web.Script( p_web.WindowOpen( 'indexPage' ))  ! reload to remove the visible parameter from browser
    END ! if   

  ! End of "Before DivHeader"
« Last Edit: June 14, 2024, 09:15:47 AM by Jane »

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: PageFooter Session Manager issue
« Reply #10 on: June 14, 2024, 03:14:33 PM »
New js file seems to work great.

Thanks, Bruce!

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PageFooter Session Manager issue
« Reply #11 on: June 15, 2024, 07:21:02 AM »
Talking about the timer it works ok, but it is not disconecting the session anymore.


BTW: Excelent idea Jane !!!
« Last Edit: June 17, 2024, 11:49:16 AM by Alberto »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PageFooter Session Manager issue
« Reply #12 on: June 18, 2024, 12:08:11 AM »
TEsted, session manager and timer work ok but the session is not disconected anymore.
Session manager goes to the defaultpage, click to login, all session values are intact, still logged in.

This is a feature, not a bug. The session is maintained for one more cycle (because when the page transfers to the index page, the session is extended, because it's a request.)
If you want it to force a logout, then do what Jane suggested.

Cheers
Bruce