Set more #[\SensitiveParameter] for #1343

This commit is contained in:
the-djmaze 2023-12-04 00:41:20 +01:00
parent f869ed5121
commit 7bd76a19b5
4 changed files with 31 additions and 7 deletions

View file

@ -116,12 +116,18 @@ class Application extends \RainLoop\Config\AbstractConfig
parent::Set($sSectionKey, $sParamKey, $mParamValue);
}
public function SetPassword(string $sPassword) : void
public function SetPassword(
#[\SensitiveParameter]
string $sPassword
) : void
{
$this->Set('security', 'admin_password', \password_hash($sPassword, PASSWORD_DEFAULT));
}
public function ValidatePassword(string $sPassword) : bool
public function ValidatePassword(
#[\SensitiveParameter]
string $sPassword
) : bool
{
$sConfigPassword = (string) $this->Get('security', 'admin_password', '');
if (32 == \strlen($sPassword) && \md5(APP_SALT.$sPassword.APP_SALT) === $sConfigPassword) {