Fixed login by cookies
authorMarcel Werk <burntime@woltlab.com>
Thu, 10 Nov 2011 16:14:55 +0000 (17:14 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 10 Nov 2011 16:14:55 +0000 (17:14 +0100)
wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php
wcfsetup/install/files/lib/data/session/Session.class.php
wcfsetup/install/files/lib/system/session/SessionHandler.class.php

index ce734a9dd2670be447d8d65197f383c891bac944..9c95a8b41b80d72e50a2c85a591dbab8124e4c9f 100644 (file)
@@ -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;
+       }
 }
index 1894c4a2637a36d48d1e4bc56f1a17eeb1e98829..566c1afb2f78c8a7381694179b535605d903c0cb 100644 (file)
@@ -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;
+       }
 }
index fa5fee9ed3ab0a055bbbbef7f64d62dc3603af31..1b828a9329a8d3bea56beb3a66de926021f1f0bc 100644 (file)
@@ -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'] : '')
                ));
        }