From ce9150c97bce1fd55bd8d55c7dcf1a373587dda7 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 10 Nov 2011 17:14:55 +0100 Subject: [PATCH] Fixed login by cookies --- .../files/lib/data/acp/session/ACPSession.class.php | 9 +++++++++ .../install/files/lib/data/session/Session.class.php | 7 +++++++ .../files/lib/system/session/SessionHandler.class.php | 7 ++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php index ce734a9dd2..9c95a8b41b 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php @@ -28,4 +28,13 @@ class ACPSession extends DatabaseObject { * @see wcf\data\DatabaseObject::$databaseTableIndexName */ protected static $databaseTableIndexName = 'sessionID'; + + /** + * Returns true, if this session type supports persistent logins. + * + * @return boolean + */ + public static function supportsPersistentLogins() { + return false; + } } diff --git a/wcfsetup/install/files/lib/data/session/Session.class.php b/wcfsetup/install/files/lib/data/session/Session.class.php index 1894c4a263..566c1afb2f 100644 --- a/wcfsetup/install/files/lib/data/session/Session.class.php +++ b/wcfsetup/install/files/lib/data/session/Session.class.php @@ -22,4 +22,11 @@ class Session extends ACPSession { * @see wcf\data\DatabaseObject::$databaseTableIndexName */ protected static $databaseTableIndexName = 'sessionID'; + + /** + * @see wcf\data\acp\session\ACPSession::supportsPersistentLogins() + */ + public static function supportsPersistentLogins() { + return true; + } } diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index fa5fee9ed3..1b828a9329 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -324,7 +324,7 @@ class SessionHandler extends SingletonFactory { $sessionID = StringUtil::getRandomID(); // get user automatically - $this->user = UserAuthenticationFactory::getUserAuthentication()->loginAutomatically(); + $this->user = UserAuthenticationFactory::getUserAuthentication()->loginAutomatically(call_user_func(array($this->sessionClassName, 'supportsPersistentLogins'))); // create user if ($this->user === null) { @@ -333,9 +333,6 @@ class SessionHandler extends SingletonFactory { $this->user = new User(null); } - // insert session into database - $requestMethod = (!empty($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ''); - // save session $this->session = call_user_func(array($this->sessionEditorClassName, 'create'), array( 'sessionID' => $sessionID, @@ -345,7 +342,7 @@ class SessionHandler extends SingletonFactory { 'userAgent' => UserUtil::getUserAgent(), 'lastActivityTime' => TIME_NOW, 'requestURI' => UserUtil::getRequestURI(), - 'requestMethod' => $requestMethod + 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '') )); } -- 2.20.1