From 750015684d04cc3422df30018dd3c65e30a81f66 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 23 Jul 2024 10:42:50 -0700 Subject: [PATCH 1/9] purges user storage files --- app/Console/Commands/Purge.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 7abd83c85..8922519c2 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Models\Accessory; +use App\Models\Actionlog; use App\Models\Asset; use App\Models\AssetModel; use App\Models\Category; @@ -15,6 +16,7 @@ use App\Models\Statuslabel; use App\Models\Supplier; use App\Models\User; use Illuminate\Console\Command; +use Illuminate\Support\Facades\Storage; class Purge extends Command { @@ -141,6 +143,15 @@ class Purge extends Command $this->info($users->count().' users purged.'); $user_assoc = 0; foreach ($users as $user) { + $rel_path = 'private_uploads/users'; + $filenames = Actionlog::where('action_type', 'uploaded') + ->where('item_id', $user->id) + ->pluck('filename'); + foreach($filenames as $filename) { + if (Storage::exists($rel_path.'/'.$filename)) { + Storage::delete($rel_path . '/' . $filename); + } + } $this->info('- User "'.$user->username.'" deleted.'); $user_assoc += $user->userlog()->count(); $user->userlog()->forceDelete(); From e395ee1878cefbb216d4cbd1cb2aab2872d42c8b Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jul 2024 15:12:32 -0700 Subject: [PATCH 2/9] adds a try catch --- app/Console/Commands/Purge.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 8922519c2..08ef7034e 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -143,15 +143,20 @@ class Purge extends Command $this->info($users->count().' users purged.'); $user_assoc = 0; foreach ($users as $user) { + $rel_path = 'private_uploads/users'; $filenames = Actionlog::where('action_type', 'uploaded') ->where('item_id', $user->id) ->pluck('filename'); foreach($filenames as $filename) { - if (Storage::exists($rel_path.'/'.$filename)) { - Storage::delete($rel_path . '/' . $filename); - } - } + try{ + if (Storage::exists($rel_path.'/'.$filename)) { + Storage::delete($rel_path . '/' . $filename); + } + } catch (\Exception $e) { + // Handle the exception or log it + Log::error('An error occurred while deleting files: ' . $e->getMessage()); + } $this->info('- User "'.$user->username.'" deleted.'); $user_assoc += $user->userlog()->count(); $user->userlog()->forceDelete(); From f9a47c8a9fc8e61ae645b5d785500f59742e814b Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jul 2024 15:12:48 -0700 Subject: [PATCH 3/9] adds a try catch --- app/Console/Commands/Purge.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 08ef7034e..b0055436f 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -16,6 +16,7 @@ use App\Models\Statuslabel; use App\Models\Supplier; use App\Models\User; use Illuminate\Console\Command; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; class Purge extends Command From d46f9776fe3a310e06d864ea539f4ec604462bbc Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jul 2024 15:14:58 -0700 Subject: [PATCH 4/9] remove text --- app/Console/Commands/Purge.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index b0055436f..5ded3917c 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -155,7 +155,6 @@ class Purge extends Command Storage::delete($rel_path . '/' . $filename); } } catch (\Exception $e) { - // Handle the exception or log it Log::error('An error occurred while deleting files: ' . $e->getMessage()); } $this->info('- User "'.$user->username.'" deleted.'); From 89d375daad337b03b1d239525d3fbcc843b509bf Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jul 2024 15:15:41 -0700 Subject: [PATCH 5/9] add indents --- app/Console/Commands/Purge.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 5ded3917c..35bbe6e9d 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -155,8 +155,8 @@ class Purge extends Command Storage::delete($rel_path . '/' . $filename); } } catch (\Exception $e) { - Log::error('An error occurred while deleting files: ' . $e->getMessage()); - } + Log::error('An error occurred while deleting files: ' . $e->getMessage()); + } $this->info('- User "'.$user->username.'" deleted.'); $user_assoc += $user->userlog()->count(); $user->userlog()->forceDelete(); From 53ad312700d982b6100b49f18f2aa10f3cc48a7e Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 29 Jul 2024 15:17:32 -0700 Subject: [PATCH 6/9] added missing closing bracket --- app/Console/Commands/Purge.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 35bbe6e9d..5c8c9be9f 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -150,13 +150,14 @@ class Purge extends Command ->where('item_id', $user->id) ->pluck('filename'); foreach($filenames as $filename) { - try{ - if (Storage::exists($rel_path.'/'.$filename)) { + try { + if (Storage::exists($rel_path . '/' . $filename)) { Storage::delete($rel_path . '/' . $filename); } - } catch (\Exception $e) { - Log::error('An error occurred while deleting files: ' . $e->getMessage()); - } + } catch (\Exception $e) { + Log::error('An error occurred while deleting files: ' . $e->getMessage()); + } + } $this->info('- User "'.$user->username.'" deleted.'); $user_assoc += $user->userlog()->count(); $user->userlog()->forceDelete(); From f19899543d7a108b37f1439235164c8412b4846d Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jul 2024 09:18:17 -0700 Subject: [PATCH 7/9] changed error to info --- app/Console/Commands/Purge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index 5c8c9be9f..1dd2aaa51 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -155,7 +155,7 @@ class Purge extends Command Storage::delete($rel_path . '/' . $filename); } } catch (\Exception $e) { - Log::error('An error occurred while deleting files: ' . $e->getMessage()); + Log::info('An error occurred while deleting files: ' . $e->getMessage()); } } $this->info('- User "'.$user->username.'" deleted.'); From 437ddc01b4366585b71b0ac08006cb53e9e579c9 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 30 Jul 2024 16:26:24 -0500 Subject: [PATCH 8/9] removed extraneous `$request->validate()` arguments --- app/Http/Controllers/Auth/ResetPasswordController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index fe1b33128..f1cfbc853 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -87,7 +87,7 @@ class ResetPasswordController extends Controller 'password.not_in' => trans('validation.disallow_same_pwd_as_user_fields'), ]; - $request->validate($this->rules(), $request->all(), $this->validationErrorMessages()); + $request->validate($this->rules()); Log::debug('Checking if '.$request->input('username').' exists'); // Check to see if the user even exists - we'll treat the response the same to prevent user sniffing From 935d2ce29a89b253c40e006cc688ab837701cd1a Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 30 Jul 2024 15:05:09 -0700 Subject: [PATCH 9/9] fixes admin box alignment --- resources/assets/less/overrides.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/assets/less/overrides.less b/resources/assets/less/overrides.less index 12bce00bb..8ef34bb3e 100644 --- a/resources/assets/less/overrides.less +++ b/resources/assets/less/overrides.less @@ -714,6 +714,11 @@ th.css-location > .th-inner::before { margin-top:50px } } +@media screen and (max-width: 1318px) and (min-width: 1200px){ + .box{ + height:170px; + } +} .ellipsis { overflow: hidden;