From 3eccb9eb2614a9188bcafb54971b9a096421ab11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 9 May 2014 18:06:42 +0200 Subject: [PATCH] Improve signon-script example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- examples/signon-script.php | 10 +++++++++- .../plugin/auth/PMA_AuthenticationSignon_test.php | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/signon-script.php b/examples/signon-script.php index e333f2ee1b..1c2a4b957a 100644 --- a/examples/signon-script.php +++ b/examples/signon-script.php @@ -23,7 +23,15 @@ */ function get_login_credentials($user) { - return array('root', ''); + /* Optionally we can use passed username */ + if (!empty($user)) { + return array($user, 'password'); + } + + /* Here we would retrieve the credentials */ + $credentials = array('root', ''); + + return $credentials; } ?> diff --git a/test/classes/plugin/auth/PMA_AuthenticationSignon_test.php b/test/classes/plugin/auth/PMA_AuthenticationSignon_test.php index 4ac056d5c5..6a1becc14a 100644 --- a/test/classes/plugin/auth/PMA_AuthenticationSignon_test.php +++ b/test/classes/plugin/auth/PMA_AuthenticationSignon_test.php @@ -133,12 +133,12 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase ); $this->assertEquals( - 'root', + 'user', $GLOBALS['PHP_AUTH_USER'] ); $this->assertEquals( - '', + 'password', $GLOBALS['PHP_AUTH_PW'] );