Skip to content

Commit

Permalink
rm validation stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerrlongg committed Mar 5, 2024
1 parent b6fa6cb commit ad0f873
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
22 changes: 0 additions & 22 deletions app/Http/Controllers/Api/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,6 @@ public function store(StoreAssetRequest $request): JsonResponse
}
}
if ($field->element == 'checkbox') {
if ($field->field_encrypted) {
// to not break a bunch of stuff, we must decrypt + implode if the checkbox value is an array
$field_val_decrypt = Crypt::decrypt($field_val);
if (is_array($field_val_decrypt)) {
$field_val_decrypt_imploded = implode(',', $field_val_decrypt);
$field_val = Crypt::encrypt($field_val_decrypt_imploded);
} else
$field_val = Crypt::encrypt($field_val_decrypt);

}
if(is_array($field_val)) {
$field_val = implode(',', $field_val);
}
Expand Down Expand Up @@ -670,24 +660,12 @@ public function update(ImageUploadRequest $request, $id)
$field_val = $request->input($field->db_column, null);

if ($request->has($field->db_column)) {
//if ($field->field_encrypted) {
// // to not break a bunch of stuff, we must decrypt + implode if the checkbox value is an array
// $field_val_decrypt = Crypt::decrypt($field_val);
// if (is_array($field_val_decrypt)) {
// $field_val_decrypt_imploded = implode(',', $field_val_decrypt);
// $field_val = Crypt::encrypt($field_val_decrypt_imploded);
// } else
// $field_val = Crypt::encrypt($field_val_decrypt);
//
//}
if ($field->field_encrypted == '1') {
if (Gate::allows('admin')) {
$asset->{$field->db_column} = Crypt::encrypt($field_val);
}
}

if ($field->element == 'checkbox') {

if(is_array($field_val)) {
$field_val = implode(',', $field_val);
$asset->{$field->db_column} = $field_val;
Expand Down
8 changes: 0 additions & 8 deletions app/Providers/ValidationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,6 @@ public function boot()
$field = CustomField::where('db_column', $attribute)->first();
$options = $field->formatFieldValuesAsArray();

// temporarily decrypt for validation
// so, this is breaking patches, i don't really get why.
// is it not encrypted here on an update? need to do more testing. :(
if($field->field_encrypted) {
$value = Crypt::decrypt($value);
}
dump(is_array($value));

if(is_array($value)) {
$invalid = array_diff($value, $options);
if(count($invalid) > 0) {
Expand Down

0 comments on commit ad0f873

Please sign in to comment.