This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Timeout for Sentora Admin Panel
#11
RE: Timeout for Sentora Admin Panel
(11-22-2018, 12:48 AM)TGates Wrote: I'm wondering if there is something in the server config that is taking over. A timeout setting in the php config maybe? I really do not have the time right now to dig into it Sad Maybe a quick snoop on google could shed some light on this Angel 

Google: php set session timeout

Or maybe see if there is a better/working way of doing this:
Google: php auto logout after inactivity

That will not work.

When the PHP script is called, the session variable does not exist yet so the "if" routine does not run, therefore nothing gets echoed from the script, therefore the jquery in the HTML code redirects to the logged out page. This happens after 60 seconds because this interval is set within the javascript. The timeout in the PHP code doesn't get a look-in. Plus, the session is never called with session_start(); so I doubt the session timeout would ever be found by the "if" routine even if we got it to run anyway.

Even if you add the necessary code to make it run, I fail to see how this would log you out if you closed your browser and reopened it again at a later time. So if that's the case, all it would do anyway is log you out if you keep the browser open and do nothing for more than 60 seconds. So why not just rewrite the javascript and use a timer within that to log you out? And forget the PHP completely?


Code:
        <!-- auto-logout JS -->
        <script type="text/javascript">
            $(document).ready(function(){
                setTimeout(function(){
                    window.location.href="?logout";
                },1*60*1000);
            });
        </script>

If you want to specify the number of seconds before auto-logout, change the "60" to the number of seconds you want. If you want to specify the timeout in minutes, leave the "60" alone and change the "1" to the number of minutes.

I'm sure you'd have to delve deeper into the session data and cookies already written by Sentora, and record the time Sentora is last visited in one of these, to then compare the next time it is opened and look if it is greater than a timeout or not, to determine whether to log someone out or not. But that's far more advanced than just timing out an open page.

If anyone sees something I don't let me know but I can't see how this ever worked as it was.

Keith
Reply
Thanks given by:
#12
RE: Timeout for Sentora Admin Panel
fearworks, Makes total sense. I just had a moment to run through and just added some suggestions.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#13
RE: Timeout for Sentora Admin Panel
(11-24-2018, 10:29 AM)TGates Wrote: @[fearworks], Makes total sense. I just had a moment to run through and just added some suggestions.

I realise that my message was slightly ambiguous - I wasn't referring to what you said specifically when I said it wouldn't work, I was reflecting on the actual PHP/HTML/Javascript code suggested earlier Smile

Keith
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Secure Sentora Domains with Let's Encrypt TGates 27 97 ,356 06-08-2024, 05:06 PM
Last Post: andykimpe
Secure Sentora With SSLForFree Chris L 1 5 ,334 01-22-2020, 09:19 PM
Last Post: ralphharder
Fail2ban for Sentora (Centos 7) bbspike 14 48 ,783 01-14-2020, 07:32 AM
Last Post: Vedran B

Forum Jump:


Users browsing this thread: 1 Guest(s)