From 809e31056528be1da90142e435b9cd3af9ac7543 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 08:15:23 -0700 Subject: [PATCH 1/3] Recrypt the LDAP password properly Older installs should add a line to their .env: `LEGACY_CIPHER=rijndael-256` --- app/Console/Commands/RecryptFromMcrypt.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/RecryptFromMcrypt.php b/app/Console/Commands/RecryptFromMcrypt.php index 60599bafae..bb38f098f9 100644 --- a/app/Console/Commands/RecryptFromMcrypt.php +++ b/app/Console/Commands/RecryptFromMcrypt.php @@ -93,15 +93,19 @@ class RecryptFromMcrypt extends Command } - if($legacy_cipher){ + if ($legacy_cipher){ $mcrypter = new McryptEncrypter($legacy_key,$legacy_cipher); }else{ $mcrypter = new McryptEncrypter($legacy_key); } $settings = Setting::getSettings(); - if ($settings->ldap_password=='') { + if ($settings->ldap_pword=='') { $this->comment('INFO: No LDAP password found. Skipping... '); + } else { + $decrypted_ldap_pword = $mcrypter->decrypt($settings->ldap_pword); + $settings->ldap_pword = \Crypt::encrypt($decrypted_ldap_pword); + $settings->save(); } /** @var CustomField[] $custom_fields */ $custom_fields = CustomField::where('field_encrypted','=', 1)->get(); From 447833c996093261e1dce1f53d73c532f49a386a Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 08:15:54 -0700 Subject: [PATCH 2/3] Only try to process model bulk editing if at least one model was selected --- app/Http/Controllers/AssetModelsController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 1a666822f8..9687fb8c4b 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -376,6 +376,9 @@ class AssetModelsController extends Controller */ public function postBulkEdit(Request $request) { + if (is_array($models_raw_array)) { + + $models_raw_array = Input::get('ids'); $models = AssetModel::whereIn('id', $models_raw_array)->get(); $nochange = ['NC' => 'No Change']; @@ -390,6 +393,10 @@ class AssetModelsController extends Controller ->with('category_list', $category_list) ->with('fieldset_list', $fieldset_list) ->with('depreciation_list', $depreciation_list); + } + + return redirect()->route('models.index') + ->with('error', 'You must select at least one model to edit.'); } From c0e50be03e8b3469013858e5643a747be099c6e5 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 08:45:05 -0700 Subject: [PATCH 3/3] Duh. Helps if you actually assign the array first. --- app/Http/Controllers/AssetModelsController.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 9687fb8c4b..a7fdd51310 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -376,16 +376,16 @@ class AssetModelsController extends Controller */ public function postBulkEdit(Request $request) { - if (is_array($models_raw_array)) { - - + $models_raw_array = Input::get('ids'); - $models = AssetModel::whereIn('id', $models_raw_array)->get(); - $nochange = ['NC' => 'No Change']; - $fieldset_list = $nochange + Helper::customFieldsetList(); - $depreciation_list = $nochange + Helper::depreciationList(); - $category_list = $nochange + Helper::categoryList('asset'); - $manufacturer_list = $nochange + Helper::manufacturerList(); + + if (is_array($models_raw_array)) { + $models = AssetModel::whereIn('id', $models_raw_array)->get(); + $nochange = ['NC' => 'No Change']; + $fieldset_list = $nochange + Helper::customFieldsetList(); + $depreciation_list = $nochange + Helper::depreciationList(); + $category_list = $nochange + Helper::categoryList('asset'); + $manufacturer_list = $nochange + Helper::manufacturerList(); return view('models/bulk-edit', compact('models'))