mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Remove Firefly III's ability to encrypt data in the database.
This commit is contained in:
@@ -143,49 +143,6 @@ class Account extends Model
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getIbanAttribute($value): string
|
||||
{
|
||||
if ('' === (string)$value) {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
$result = Crypt::decrypt($value);
|
||||
} catch (DecryptException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
throw new FireflyException('Cannot decrypt value "' . $value . '" for account #' . $this->id);
|
||||
}
|
||||
if (null === $result) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Encryption\DecryptException
|
||||
*/
|
||||
public function getNameAttribute($value): ?string
|
||||
{
|
||||
if ($this->encrypted) {
|
||||
return Crypt::decrypt($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the opening balance.
|
||||
*
|
||||
@@ -237,31 +194,6 @@ class Account extends Model
|
||||
$query->whereIn('account_types.type', $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
||||
*/
|
||||
public function setIbanAttribute($value): void
|
||||
{
|
||||
$this->attributes['iban'] = Crypt::encrypt($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
||||
*/
|
||||
public function setNameAttribute($value): void
|
||||
{
|
||||
$encrypt = config('firefly.encryption');
|
||||
$this->attributes['name'] = $encrypt ? Crypt::encrypt($value) : $value;
|
||||
$this->attributes['encrypted'] = $encrypt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user