Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Automatic Logout/Browser Refresh Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Automatic Logout/Browser Refresh

Unread post by saultpastor »

I have struggled with this for several years with nuBuilder, And am wondering if there is an elegant solution.

I use a common login for all members of our team so they can check in quickly. This check-in screen stays open on a dedicated terminal 24/7. Unfortunately the login times out, no matter what number I enter in the settings for nuBuilder. My solution is to put a note on the terminal that if the screen is frozen to use ctrl-R to refresh the browser which brings up the generic login with the username and password filled in. I have in the past gone through the timeout settings in php.ini (of which there are multiples) and mysql timeout settings, and have had varied success, but I can never remember which ones worked better and I have never been able to get it to just stay logged in and running.

Solutions:
1. Someone would be willing to hold my hand and help me make it stay running 24/7 (this is a lot to ask)
2. there is an easy way to make it so nuBuilder would at least log itself out and go back to the login screen when it times out so the next person to check-in doesn't have to use ctrl-R to refresh the browser.

Thank you
Craig
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Automatic Logout/Browser Refresh

Unread post by kev1n »

Hi,

I'm not sure if the following is going to work. Create a "dummy" procedure with e.g. code keep_alive and with a PHP code that just contains one space.

Then add this JS to your form's custom code. Replace 61c9aaa83024575 with your form's Id (see Option Menu -> Form info)
This will run the keep_alive-procedure in a defined interval (e.g. every 60s) and hopfully keep the session alive.

Code: Select all

var intervalID = null;

function runProcedure(code, formId) {

    if (nuGetProperty('form_id') !== formId || nuFormType() !== 'edit') {
        clearInterval(intervalID);
    } else {
        nuRunPHPHidden(code, 0);
    }
}

intervalID = setInterval(() => runProcedure('keep_alive','61c9aaa83024575'), 60000);
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Re: Automatic Logout/Browser Refresh

Unread post by saultpastor »

Thanks Kev1n,
Testing now, I'll report back.
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Re: Automatic Logout/Browser Refresh

Unread post by saultpastor »

This working perfectly, thanks so much for helping!
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Automatic Logout/Browser Refresh

Unread post by kev1n »

This is now incorporated into nuBuilder. Set $nuConfigKeepSessionAlive = true in nuconfig.php to keep a session alive.
vario
Posts: 148
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: Automatic Logout/Browser Refresh

Unread post by vario »

I have set $nuConfigKeepSessionAlive = true but my user sessions still timeout. Is there anything else I need to do (e.g php config on the server) for it to work? Or does this only prevent the login screen from timeout?

Neil.
Post Reply