Remove the from_cookie global variable
Replaces it with AuthenticationCookie::$fromCookie static property. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
4f4f31e7e9
commit
06c62ee3e3
@ -10896,12 +10896,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Plugins/Auth/AuthenticationCookie.php
|
||||
|
||||
-
|
||||
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
|
||||
identifier: if.condNotBoolean
|
||||
count: 1
|
||||
path: src/Plugins/Auth/AuthenticationCookie.php
|
||||
|
||||
-
|
||||
message: '#^Only booleans are allowed in an if condition, string given\.$#'
|
||||
identifier: if.condNotBoolean
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
|
||||
<globals>
|
||||
<var name="GLOBALS" type="array{
|
||||
from_cookie: bool,
|
||||
knjenc: string,
|
||||
maxsize: string,
|
||||
memory_limit: int,
|
||||
|
||||
@ -60,9 +60,9 @@ use const SODIUM_CRYPTO_SECRETBOX_NONCEBYTES;
|
||||
class AuthenticationCookie extends AuthenticationPlugin
|
||||
{
|
||||
public static string $connectionError = '';
|
||||
|
||||
/** The user provided server to connect to */
|
||||
public static string $authServer = '';
|
||||
public static bool $fromCookie = false;
|
||||
|
||||
/**
|
||||
* Displays authentication form
|
||||
@ -219,7 +219,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
self::$authServer = '';
|
||||
|
||||
$this->user = $this->password = '';
|
||||
$GLOBALS['from_cookie'] = false;
|
||||
self::$fromCookie = false;
|
||||
|
||||
$config = Config::getInstance();
|
||||
if (isset($_POST['pma_username']) && $_POST['pma_username'] != '') {
|
||||
@ -388,7 +388,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
self::$authServer = $authData['server'];
|
||||
}
|
||||
|
||||
$GLOBALS['from_cookie'] = true;
|
||||
self::$fromCookie = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -463,7 +463,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
|
||||
// Set server cookies if required (once per session) and, in this case,
|
||||
// force reload to ensure the client accepts cookies
|
||||
if ($GLOBALS['from_cookie']) {
|
||||
if (self::$fromCookie) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -515,7 +515,7 @@ class AuthenticationCookieTest extends AbstractTestCase
|
||||
$this->object->readCredentials(),
|
||||
);
|
||||
|
||||
self::assertTrue($GLOBALS['from_cookie']);
|
||||
self::assertTrue(AuthenticationCookie::$fromCookie);
|
||||
|
||||
self::assertSame('', $this->object->password);
|
||||
}
|
||||
@ -567,7 +567,7 @@ class AuthenticationCookieTest extends AbstractTestCase
|
||||
$this->object->password = 'testPW';
|
||||
Current::$server = 2;
|
||||
$config->settings['LoginCookieStore'] = 100;
|
||||
$GLOBALS['from_cookie'] = true;
|
||||
AuthenticationCookie::$fromCookie = true;
|
||||
$config->set('is_https', false);
|
||||
|
||||
$this->object->storeCredentials();
|
||||
@ -599,7 +599,7 @@ class AuthenticationCookieTest extends AbstractTestCase
|
||||
AuthenticationCookie::$authServer = 'b 2';
|
||||
$this->object->password = 'testPW';
|
||||
$config->settings['LoginCookieStore'] = 100;
|
||||
$GLOBALS['from_cookie'] = false;
|
||||
AuthenticationCookie::$fromCookie = false;
|
||||
|
||||
$responseStub = new ResponseRendererStub();
|
||||
(new ReflectionProperty(ResponseRenderer::class, 'instance'))->setValue(null, $responseStub);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user