getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Session expires in 30 mins independent from config settings. #178

Closed heavydetail closed 5 years ago

heavydetail commented 5 years ago

Hi, see title, Session expires in 30 mins independent from configuration settings.

How can I diagnose this problem? The set cookies have weird expiry dates (like ~18h) which have not been set anywhere and don't seem to be logging the users in.

I am using the private-site plugin to secure the whole site. Session sharing (log in on frontend be logged in in backend too) seems to work OK. I am guessing the private-site plugin uses this grav-plugin-login for its login procedure, thats why I am asking here. Even without session sharing and login via backend the same thing happens, logout in 30 mins.

What could be the cause why the session expires in ~30 mins instead of the session expiration of a week (in secs) that i set in the global grav session configuration section? Do I have to set some session path or any other configuration (in which plugin or in the global yaml file)? Unsure about the mechanics at play here.

It is frustrating as it happens to all my users constantly and is super annoying for quick edits on a documentation page (theme learn2-git-sync). Its the newest Grav version (Grav v1.5.1 - Admin v1.8.9) running on Debian 9, nginx.

thanks!

mahagr commented 5 years ago

Make sure that setenv() is allowed in your server.

heavydetail commented 5 years ago

do you mean the linux setenv command? the PHP putenv() function or the apache_setenv? (i am on nginx) if its the linux setenv how do i check if its allowed and for whom? www-data? please explain.

mahagr commented 5 years ago

I meant that PHP has a function setenv() which can be disabled in PHP configuration by not allowing it to be called.

lufog commented 5 years ago

@mahagr For security reasons, this feature is disabled on many webhosts. If Grav depends on this function, this limits the list of available hosting providers...

mahagr commented 5 years ago

@DebuggeR94 Grav, Symfony and many others depend on setenv() because of it is the only way to set most of the session settings. I can make it fall back to the more limited way for timeout, but it is not guaranteed that sessions work as intended depending on host settings.

akaunderr commented 5 years ago

Make sure that setenv() is allowed in your server.

I tried to find something about setenv() function in PHP but found nothing. Could you explain, please, how and where can i check/enable it. I use Grav v1.5.1, Admin v1.8.9, Debian + PHP7.0 + nginx Thanks!

mahagr commented 5 years ago

Should be fixed in latest Grav CI build.

akaunderr commented 5 years ago

Unfortunately, nothing changed for me with new version... PHP 7.0.3, nginx 1.10.3, Grav v1.5.2 - Admin v1.8.10

mahagr commented 5 years ago

I don't know what it could be, something in your system prevents timeout from being changed.