Revert default password setting & using "HiddenString" even for empty strings
This commit is contained in:
parent
ab7c6499ff
commit
e1d135238a
|
@ -22,7 +22,7 @@ return [
|
||||||
|
|
||||||
// pass (String)
|
// pass (String)
|
||||||
// Database user password. Please don't use empty passwords.
|
// Database user password. Please don't use empty passwords.
|
||||||
'password' => new \ParagonIE\HiddenString\HiddenString(''),
|
'password' => '',
|
||||||
|
|
||||||
// base (String)
|
// base (String)
|
||||||
// Database name.
|
// Database name.
|
||||||
|
|
|
@ -95,7 +95,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
|
||||||
|
|
||||||
if ($this->hidePasswordOutput &&
|
if ($this->hidePasswordOutput &&
|
||||||
$key == 'password' &&
|
$key == 'password' &&
|
||||||
!empty($value) && is_string($value)) {
|
is_string($value)) {
|
||||||
$this->config[$cat][$key] = new HiddenString((string) $value);
|
$this->config[$cat][$key] = new HiddenString((string) $value);
|
||||||
} else {
|
} else {
|
||||||
$this->config[$cat][$key] = $value;
|
$this->config[$cat][$key] = $value;
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Test\src\Core\Config\Cache;
|
||||||
|
|
||||||
use Friendica\Core\Config\Cache\ConfigCache;
|
use Friendica\Core\Config\Cache\ConfigCache;
|
||||||
use Friendica\Test\MockedTest;
|
use Friendica\Test\MockedTest;
|
||||||
|
use ParagonIE\HiddenString\HiddenString;
|
||||||
|
|
||||||
class ConfigCacheTest extends MockedTest
|
class ConfigCacheTest extends MockedTest
|
||||||
{
|
{
|
||||||
|
@ -322,7 +323,8 @@ class ConfigCacheTest extends MockedTest
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEmpty($configCache->get('database', 'password'));
|
$this->assertNotEmpty($configCache->get('database', 'password'));
|
||||||
|
$this->assertInstanceOf(HiddenString::class, $configCache->get('database', 'password'));
|
||||||
$this->assertEmpty($configCache->get('database', 'username'));
|
$this->assertEmpty($configCache->get('database', 'username'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user