Api: Fix sharing lost session ID causing logout

This commit is contained in:
nathangray 2020-03-05 13:57:15 -07:00
parent 4f9f699827
commit 07561bf01d

View File

@ -21,10 +21,12 @@
namespace EGroupware\Api; namespace EGroupware\Api;
use PragmaRX\Google2FA; use DateInterval;
use EGroupware\Api\Mail\Credentials; use EGroupware\Api\Mail\Credentials;
use EGroupware\OpenID; use EGroupware\OpenID;
use ErrorException;
use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\OAuthServerException;
use PragmaRX\Google2FA;
/** /**
* Create, verifies or destroys an EGroupware session * Create, verifies or destroys an EGroupware session
@ -938,7 +940,7 @@ class Session
if ($ts) if ($ts)
{ {
$expiration = new DateTime('now', DateTime::$server_timezone); $expiration = new DateTime('now', DateTime::$server_timezone);
$expiration->add(new \DateInterval($lifetime)); $expiration->add(new DateInterval($lifetime));
return $expiration->format('ts'); return $expiration->format('ts');
} }
return $lifetime; return $lifetime;
@ -1171,7 +1173,7 @@ class Session
* @var array * @var array
*/ */
static $pseudo_session_scripts = array( static $pseudo_session_scripts = array(
'webdav.php', 'groupdav.php', 'remote.php', 'share.php' 'webdav.php', 'groupdav.php', 'remote.php'
); );
/** /**
@ -1967,14 +1969,14 @@ class Session
* Initialise the used session handler * Initialise the used session handler
* *
* @return boolean true if we have a session, false otherwise * @return boolean true if we have a session, false otherwise
* @throws \ErrorException if there is no PHP session support * @throws ErrorException if there is no PHP session support
*/ */
public static function init_handler() public static function init_handler()
{ {
switch(session_status()) switch(session_status())
{ {
case PHP_SESSION_DISABLED: case PHP_SESSION_DISABLED:
throw new \ErrorException('EGroupware requires PHP session extension!'); throw new ErrorException('EGroupware requires PHP session extension!');
case PHP_SESSION_NONE: case PHP_SESSION_NONE:
if (headers_sent()) return false; // only gives warnings if (headers_sent()) return false; // only gives warnings
ini_set('session.use_cookies',0); // disable the automatic use of cookies, as it uses the path / by default ini_set('session.use_cookies',0); // disable the automatic use of cookies, as it uses the path / by default