diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 15b028e0e4..504218c05f 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -988,6 +988,8 @@ if (! defined('PMA_MINIMUM_COMMON')) { $controllink = $userlink; } + $auth_plugin->storeUserCredentials(); + /* Log success */ PMA_logUser($cfg['Server']['user']); diff --git a/libraries/plugins/AuthenticationPlugin.class.php b/libraries/plugins/AuthenticationPlugin.class.php index 8ba6679c39..457de4ca71 100644 --- a/libraries/plugins/AuthenticationPlugin.class.php +++ b/libraries/plugins/AuthenticationPlugin.class.php @@ -38,6 +38,15 @@ abstract class AuthenticationPlugin */ abstract public function authSetUser(); + /** + * Stores user credentials after successful login. + * + * @return void + */ + public function storeUserCredentials() + { + } + /** * User is not allowed to login to MySQL -> authentication failed * diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index dd315b42f7..9f67209da0 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -560,6 +560,16 @@ class AuthenticationCookie extends AuthenticationPlugin } else { $_SESSION['last_access_time'] = time(); } + } + + /** + * Stores user credentials after successful login. + * + * @return void + */ + public function storeUserCredentials() + { + global $cfg; $this->createIV(); diff --git a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php index d77bd7b389..30bee3566c 100644 --- a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php +++ b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php @@ -803,6 +803,8 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase isset($_SERVER['PHP_AUTH_PW']) ); + $this->object->storeUserCredentials(); + $this->assertTrue( isset($_COOKIE['pmaUser-1']) ); @@ -872,6 +874,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $attrInstance->setValue($mockResponse); $this->object->authSetUser(); + $this->object->storeUserCredentials(); $this->assertTrue( isset($_COOKIE['pmaServer-2']) diff --git a/test/classes/plugin/auth/PMA_AuthenticationHttp_test.php b/test/classes/plugin/auth/PMA_AuthenticationHttp_test.php index e898d7713f..036084c42e 100644 --- a/test/classes/plugin/auth/PMA_AuthenticationHttp_test.php +++ b/test/classes/plugin/auth/PMA_AuthenticationHttp_test.php @@ -40,6 +40,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase $GLOBALS['PMA_Config']->enableBc(); $GLOBALS['server'] = 0; $GLOBALS['lang'] = "en"; + $GLOBALS['text_dir'] = "ltr"; $GLOBALS['available_languages'] = array( "en" => array("English", "US-ENGLISH"), "ch" => array("Chinese", "TW-Chinese") diff --git a/test/libraries/PMA_insert_edit_test.php b/test/libraries/PMA_insert_edit_test.php index 9be5bdb28d..137016870c 100644 --- a/test/libraries/PMA_insert_edit_test.php +++ b/test/libraries/PMA_insert_edit_test.php @@ -217,6 +217,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase ->setMethods(array('addHtml')) ->getMock(); + $restoreInstance = PMA_Response::getInstance(); $response = new ReflectionProperty('PMA_Response', '_instance'); $response->setAccessible(true); $response->setValue($responseMock); @@ -225,6 +226,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase array(false), 0, array('1'), 'SELECT', array('1' => 'result1') ); + $response->setValue($restoreInstance); + $this->assertFalse($result); } @@ -1926,12 +1929,15 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase ->method('getHeader') ->will($this->returnValue($headerMock)); + $restoreInstance = PMA_Response::getInstance(); $response = new ReflectionProperty('PMA_Response', '_instance'); $response->setAccessible(true); $response->setValue($responseMock); PMA_isInsertRow(); + $response->setValue($restoreInstance); + $this->assertEquals(5, $GLOBALS['cfg']['InsertRows']); } @@ -2765,6 +2771,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase ->setMethods(array('addHtml')) ->getMock(); + $restoreInstance = PMA_Response::getInstance(); $response = new ReflectionProperty('PMA_Response', '_instance'); $response->setAccessible(true); $response->setValue($responseMock); @@ -2792,6 +2799,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $result = PMA_determineInsertOrEdit(null, 'db', 'table'); + $response->setValue($restoreInstance); + $this->assertEquals( array( true,