]> source.dussan.org Git - nextcloud-server.git/commitdiff
don't regenerate Session ID twice, also fixes tests
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Fri, 2 Dec 2016 10:16:33 +0000 (11:16 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 6 Apr 2017 13:22:43 +0000 (15:22 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
lib/private/User/Session.php

index dca5ff394ac5940cb97f58ce38a9f971c183b7ea..9bbf62b5275b77def37f98088357d6d51433e404 100644 (file)
@@ -328,10 +328,11 @@ class Session implements IUserSession, Emitter {
        /**
         * @param IUser $user
         * @param array $loginDetails
+        * @param bool $regenerateSessionId
         * @return bool
         * @throws LoginException
         */
-       public function completeLogin(IUser $user, array $loginDetails) {
+       public function completeLogin(IUser $user, array $loginDetails, $regenerateSessionId = true) {
                if (!$user->isEnabled()) {
                        // disabled users can not log in
                        // injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
@@ -339,7 +340,9 @@ class Session implements IUserSession, Emitter {
                        throw new LoginException($message);
                }
 
-               $this->session->regenerateId();
+               if($regenerateSessionId) {
+                       $this->session->regenerateId();
+               }
 
                $this->setUser($user);
                $this->setLoginName($loginDetails['loginName']);
@@ -536,7 +539,7 @@ class Session implements IUserSession, Emitter {
                        return false;
                }
 
-               return $this->completeLogin($user, ['loginName' => $uid, 'password' => $password]);
+               return $this->completeLogin($user, ['loginName' => $uid, 'password' => $password], false);
        }
 
        /**
@@ -570,7 +573,7 @@ class Session implements IUserSession, Emitter {
                        return false;
                }
 
-               return $this->completeLogin($user, ['loginName' => $uid, 'password' => $password, 'token' => $dbToken]);
+               return $this->completeLogin($user, ['loginName' => $uid, 'password' => $password, 'token' => $dbToken], false);
        }
 
        /**