mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Fix session problem on 32 bit systems when using "stay logged in permanently" (fixes #278)
This commit is contained in:
parent
9e7d62b62d
commit
b1adaa24cf
@ -30,7 +30,7 @@ class LoginController extends BaseController
|
|||||||
if ($user !== null && password_verify($inputPassword, $user->password))
|
if ($user !== null && password_verify($inputPassword, $user->password))
|
||||||
{
|
{
|
||||||
$sessionKey = $this->SessionService->CreateSession($user->id, $stayLoggedInPermanently);
|
$sessionKey = $this->SessionService->CreateSession($user->id, $stayLoggedInPermanently);
|
||||||
setcookie($this->SessionCookieName, $sessionKey, intval(time() + 31220640000)); // Cookie expires in 999 years, but session validity is up to SessionService
|
setcookie($this->SessionCookieName, $sessionKey, PHP_INT_SIZE == 4 ? PHP_INT_MAX : PHP_INT_MAX>>32); // Cookie expires never, but session validity is up to SessionService
|
||||||
|
|
||||||
if (password_needs_rehash($user->password, PASSWORD_DEFAULT))
|
if (password_needs_rehash($user->password, PASSWORD_DEFAULT))
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ class SessionService extends BaseService
|
|||||||
$expires = date('Y-m-d H:i:s', intval(time() + 2592000)); // Default is that sessions expire in 30 days
|
$expires = date('Y-m-d H:i:s', intval(time() + 2592000)); // Default is that sessions expire in 30 days
|
||||||
if ($stayLoggedInPermanently === true)
|
if ($stayLoggedInPermanently === true)
|
||||||
{
|
{
|
||||||
$expires = date('Y-m-d H:i:s', intval(time() + 31220640000)); // 999 years aka forever
|
$expires = date('Y-m-d H:i:s', PHP_INT_SIZE == 4 ? PHP_INT_MAX : PHP_INT_MAX>>32); // Never
|
||||||
}
|
}
|
||||||
|
|
||||||
$sessionRow = $this->Database->sessions()->createRow(array(
|
$sessionRow = $this->Database->sessions()->createRow(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user