mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 07:27:04 +03:00
Prevent decrypt error for #859
This commit is contained in:
parent
b182372b83
commit
c4df524a06
2 changed files with 11 additions and 4 deletions
|
|
@ -91,9 +91,11 @@ abstract class AbstractConfig implements \JsonSerializable
|
||||||
public function getDecrypted(string $sSection, string $sName, $mDefault = null)
|
public function getDecrypted(string $sSection, string $sName, $mDefault = null)
|
||||||
{
|
{
|
||||||
// $salt = \basename($this->sFile) not possible due to RainLoop\Plugins\Property
|
// $salt = \basename($this->sFile) not possible due to RainLoop\Plugins\Property
|
||||||
return isset($this->aData[$sSection][$sName][0])
|
if (!empty($this->aData[$sSection][$sName][0])) try {
|
||||||
? \SnappyMail\Crypt::DecryptFromJSON($this->aData[$sSection][$sName][0], \APP_SALT)
|
return \SnappyMail\Crypt::DecryptFromJSON($this->aData[$sSection][$sName][0], \APP_SALT);
|
||||||
: $mDefault;
|
} catch (\Throwable $e) {
|
||||||
|
}
|
||||||
|
return $mDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEncrypted(string $sSectionKey, string $sParamKey, $mParamValue) : void
|
public function setEncrypted(string $sSectionKey, string $sParamKey, $mParamValue) : void
|
||||||
|
|
|
||||||
|
|
@ -187,9 +187,14 @@ class Property implements \JsonSerializable
|
||||||
#[\ReturnTypeWillChange]
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
|
$mValue = $this->mValue;
|
||||||
|
if ($this->encrypted && $mValue) try {
|
||||||
|
$mValue = \SnappyMail\Crypt::DecryptFromJSON($mValue, \APP_SALT);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
}
|
||||||
return array(
|
return array(
|
||||||
'@Object' => 'Object/PluginProperty',
|
'@Object' => 'Object/PluginProperty',
|
||||||
'value' => $this->encrypted ? \SnappyMail\Crypt::DecryptFromJSON($this->mValue, \APP_SALT) : $this->mValue,
|
'value' => $mValue,
|
||||||
'placeholder' => $this->sPlaceholder,
|
'placeholder' => $this->sPlaceholder,
|
||||||
'name' => $this->sName,
|
'name' => $this->sName,
|
||||||
'type' => $this->iType,
|
'type' => $this->iType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue