Topic: Auto-Logout

First of all thanks for this calendar. It helped me a lot.

My question:

At what point is it possible to integrate an automatic logout?
My idea was previously to set a cookie when a user has successfully logged in and evaluate this cookie in the index.php.

Which variable values do I have to reset in the index.php to get the login mask when the automatic logout time is reached?

Thank you for your answer.

Re: Auto-Logout

Hi there,

I'm not quite sure what you mean. Would you like to force a log out after a certain number of minutes?

This is how it works at the moment:
- If a user logs in and checks the "Remember me" check box, then a cookie with the user ID is stored. So each time the user starts the calendar he/she will be logged in automatically. If the "Remember me" check box was not checked, the user will have to log in each time he/she starts the calendar.
- When the calendar is started, the PHP session mechanism is used to remember the current user and his/her last selections during the time the user is using the calendar (the calendar session).
- The PHP session length stored in the PHP installation (php.ini file) is for most installations set to 1440 seconds which is 24 minutes. This means that if a user stays inside the calendar without any activity, his/her session will expire after 24 minutes. This means that at the following action a message will be displayed and the user will have to refresh the page.

Maybe with this knowledge you could give me further details of what you would like to do.
Regards,Roel

Re: Auto-Logout

Hey Roel,

Yes, a logout after a certain number of minutes.

So I would have to evaluate the cookie expires time somewhere in the index.php and then, with expired cookie, to be able to set the appropriate values so that the user gets to see the login form.

Re: Auto-Logout

This depends . . .
Do you want to set the automatic logout time to < 24 minutes, in other words: do you want to abort the PHP session?
I assume that if you want to automatically logout users after a limited number of minutes, you also want to remove the "Remember me" check box from the login page.
Let me know if I'm correct and thereafter I will try give you a hint on what should be done.

What calendar version are you using?
Roel

Re: Auto-Logout

Yes exactly. Reason: multiple users on the same Computer.
Version is 4.6.0M

Re: Auto-Logout

Try the following:
- edit the file pages/login.php and to get rid of the "Remember me" check box delete line 204:

<span class='floatR'><input type='checkbox' id='cookie' name='cookie' value='1' ".(isset($_COOKIE['LCALuid']) ? " checked" : '')."><label for='cookie'> {$ax['log_remember_me']}</label></span>

- edit the file index.php in the calendar root and before line 65 (session_start();) add the following line:

session_set_cookie_params(1440);

and replace "1440" (in the line above) by the number of seconds you would like a session to last. E.g. 600 = 10 minutes.

Roel

Re: Auto-Logout

Thank you, Roel! It works....!

Have a nice day!

Michael

Re: Auto-Logout

Great Michael! You too.
Roel