From b221d99e7ba922d22f1dca651cce7abc464cf9f3 Mon Sep 17 00:00:00 2001 From: MrM <11910225+mauro-miatello@users.noreply.github.com> Date: Sun, 31 Mar 2024 12:27:35 +0200 Subject: [PATCH] Encrypted values enhancement Show asterisks instead of the value, respecting the length of the field --- resources/views/hardware/view.blade.php | 31 ++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 461f2a4688..07f24ec3dd 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -415,19 +415,24 @@ @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) @can('assets.view.encrypted_custom_fields') - ******** - - @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) - {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} - @elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!='')) - {{ \App\Helpers\Helper::gracefulDecrypt($field, \App\Helpers\Helper::getFormattedDateObject($asset->{$field->db_column_name()}, 'date', false)) }} - @else - {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} - @endif - - + @php + $fieldSize=strlen(Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()})) + @endphp + @if ($fieldSize>0) + {{ str_repeat('*', $fieldSize) }} + + @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) + {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} + @elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!='')) + {{ \App\Helpers\Helper::gracefulDecrypt($field, \App\Helpers\Helper::getFormattedDateObject($asset->{$field->db_column_name()}, 'date', false)) }} + @else + {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} + @endif + + + @endif @else {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }} @endcan