Removes setting the encryption status on update (#5833)

When we are updating a custom field, we don’t want to change the „field_encrypted“-setting on it.
This commit is contained in:
Till Deeke 2018-07-13 13:04:30 +02:00 committed by snipe
parent b4542d4d42
commit 0fb9f42ba4
2 changed files with 7 additions and 2 deletions

View file

@ -59,7 +59,13 @@ class CustomFieldsController extends Controller
{
$this->authorize('update', CustomField::class);
$field = CustomField::findOrFail($id);
$data = $request->all();
/**
* Updated values for the field,
* without the "field_encrypted" flag, preventing the change of encryption status
* @var array
*/
$data = $request->except(['field_encrypted']);
$validator = Validator::make($data, $field->validationRules());
if ($validator->fails()) {

View file

@ -183,7 +183,6 @@ class CustomFieldsController extends Controller
$field->name = e($request->get("name"));
$field->element = e($request->get("element"));
$field->field_values = e($request->get("field_values"));
$field->field_encrypted = e($request->get("field_encrypted", 0));
$field->user_id = Auth::user()->id;
$field->help_text = $request->get("help_text");
$field->show_in_email = $request->get("show_in_email", 0);