mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #14728 from snipe/fixes/smarter_decryption_in_activity
Only attempt to decrypt custom fields in activity log if the value is not empty
This commit is contained in:
commit
4119526889
|
@ -85,20 +85,23 @@ class ActionlogsTransformer
|
||||||
$enc_old = '';
|
$enc_old = '';
|
||||||
$enc_new = '';
|
$enc_new = '';
|
||||||
|
|
||||||
|
if ($this->clean_field($fieldata->old!='')) {
|
||||||
try {
|
try {
|
||||||
$enc_old = \Crypt::decryptString($this->clean_field($fieldata->old));
|
$enc_old = \Crypt::decryptString($this->clean_field($fieldata->old));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Log::debug('Could not decrypt field - maybe the key changed?');
|
\Log::debug('Could not decrypt old field value - maybe the key changed?');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->clean_field($fieldata->new!='')) {
|
||||||
try {
|
try {
|
||||||
$enc_new = \Crypt::decryptString($this->clean_field($fieldata->new));
|
$enc_new = \Crypt::decryptString($this->clean_field($fieldata->new));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Log::debug('Could not decrypt field - maybe the key changed?');
|
\Log::debug('Could not decrypt new field value - maybe the key changed?');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($enc_old != $enc_new) {
|
if ($enc_old != $enc_new) {
|
||||||
\Log::debug('custom fields do not match');
|
|
||||||
$clean_meta[$fieldname]['old'] = "************";
|
$clean_meta[$fieldname]['old'] = "************";
|
||||||
$clean_meta[$fieldname]['new'] = "************";
|
$clean_meta[$fieldname]['new'] = "************";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue