Make better use of SnappyMail\SensitiveString

This commit is contained in:
the-djmaze 2024-02-27 11:03:36 +01:00
parent 0f7505baba
commit 7cacc9b503
18 changed files with 84 additions and 147 deletions

View file

@ -91,7 +91,6 @@ class SnappyMailHelper
*/
if ($doLogin && $aCredentials[1] && $aCredentials[2]) {
try {
$oActions->Logger()->AddSecret($aCredentials[2]);
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2]);
if ($oAccount) {
// Must be here due to bug #1241
@ -202,9 +201,10 @@ class SnappyMailHelper
return \SnappyMail\Crypt::EncryptUrlSafe($sPassword, $sSalt);
}
public static function decodePassword(string $sPassword, string $sSalt)/* : mixed */
public static function decodePassword(string $sPassword, string $sSalt) : ?\SnappyMail\SensitiveString
{
static::loadApp();
return \SnappyMail\Crypt::DecryptUrlSafe($sPassword, $sSalt);
$result = \SnappyMail\Crypt::DecryptUrlSafe($sPassword, $sSalt);
return $result ? new \SnappyMail\SensitiveString($result) : $result;
}
}