Permanent login does't work

Notice: This thread is very old.
Member | 57

I used sandbox and because I have only private part of system (only logged users can see pages), all presenters inherits from BaseSecuredPresenter:

	public function startup() {

		if (!$this->user->isLoggedIn() && $this->getName() !== "Sign" && $this->getAction() !== 'In') {

SignPresenter is more or less from sandbox:

	public function signInFormSucceeded($form, $values)
		if ($values->remember) {
			$this->getUser()->setExpiration('14 days', FALSE);
		} else {
			$this->getUser()->setExpiration('20 minutes', TRUE);

		try {
			$this->getUser()->login($values->username, $values->password);

		} catch (Nette\Security\AuthenticationException $e) {

In config.neon is:

		expiration: 14 days

Problem is, that system kicks me out after more or less 30 minutes of inactivity. But ini_get('session.gc_maxlifetime') == 1209600, PHPSESSID cookie has expiration in 14 days and $this->user->getLogoutReason() == NULL. Working on Debian/apache on localhost.

Can someone tell me what I'm missing?

Thanks a lot!

Member | 108

Debian cleans default session folder by cron –…g-phps-built – it deletes all session files older than maximal maxlifetime defined in some php.ini (apache, fpm, cli.. it uses maximal value found). But if the max lifetime is set in php script, this cron does not know about it.

I think that easiest solution is to set custom session folder for your Nette app.



It worked! You're great! :)

For future readers, Add path to dir in config.neon:

		expiration: 14 days
		savePath: %appDir%/../sessions

Thanks again!

6 years ago