mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch decrypt exceptions.
This commit is contained in:
parent
3d58fbebec
commit
cbe3fb73a8
@ -12,6 +12,8 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +50,11 @@ class Preference extends Model
|
|||||||
*/
|
*/
|
||||||
public function getDataAttribute($value)
|
public function getDataAttribute($value)
|
||||||
{
|
{
|
||||||
$data = Crypt::decrypt($value);
|
try {
|
||||||
|
$data = Crypt::decrypt($value);
|
||||||
|
} catch (DecryptException $e) {
|
||||||
|
throw new FireflyException('Could not decrypt preference #' . $this->id . '.');
|
||||||
|
}
|
||||||
|
|
||||||
return json_decode($data);
|
return json_decode($data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user