From 5254c619065aad664af3494cf37ddf7832b06a72 Mon Sep 17 00:00:00 2001 From: Spitfire Date: Wed, 8 Jan 2025 06:34:22 -0600 Subject: [PATCH 1/2] Skip checks for deletion on local --- app/Http/Middleware/PasswordConfirm.php | 4 ++++ resources/views/campaigns/delete.blade.php | 2 +- resources/views/settings/account.blade.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/PasswordConfirm.php b/app/Http/Middleware/PasswordConfirm.php index 5e26f2bd4f..494cf09107 100644 --- a/app/Http/Middleware/PasswordConfirm.php +++ b/app/Http/Middleware/PasswordConfirm.php @@ -77,6 +77,10 @@ public function handle($request, Closure $next, $redirectToRoute = null) */ protected function shouldConfirmPassword($request) { + if (app()->isLocal()) { + return false; + } + $confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0); return $confirmedAt > $this->passwordTimeout; diff --git a/resources/views/campaigns/delete.blade.php b/resources/views/campaigns/delete.blade.php index 57d4f4107d..6ff4680e1b 100644 --- a/resources/views/campaigns/delete.blade.php +++ b/resources/views/campaigns/delete.blade.php @@ -45,7 +45,7 @@

- + isLocal()) value="delete" @endif autofocus maxlength="10" required id="campaign-delete-form" class="w-full" /> diff --git a/resources/views/settings/account.blade.php b/resources/views/settings/account.blade.php index 51f0395e7c..58d195d1d7 100644 --- a/resources/views/settings/account.blade.php +++ b/resources/views/settings/account.blade.php @@ -126,7 +126,7 @@ {!! __('profiles.sections.delete.goodbye', ['code' => 'goodbye']) !!}

- + isLocal()) value="goodbye" @endif required /> From 6481bf31093c763b1c0456e96ad5fabd8bc933d5 Mon Sep 17 00:00:00 2001 From: spitfire305 Date: Wed, 8 Jan 2025 12:36:18 +0000 Subject: [PATCH 2/2] Fix styling --- app/Http/Controllers/Search/ListController.php | 8 ++++---- app/Rules/Location.php | 5 ++--- app/Services/Search/LiveSearchService.php | 1 - app/View/Components/Forms/Foreign.php | 1 - routes/campaigns/campaign.php | 4 ++-- routes/campaigns/search.php | 4 ++-- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Search/ListController.php b/app/Http/Controllers/Search/ListController.php index a00c3c2242..01a568d1fc 100644 --- a/app/Http/Controllers/Search/ListController.php +++ b/app/Http/Controllers/Search/ListController.php @@ -21,10 +21,10 @@ public function index(Request $request, Campaign $campaign, EntityType $entityTy { return response()->json( $this->service - ->campaign($campaign) - ->request($request) - ->entityType($entityType) - ->search() + ->campaign($campaign) + ->request($request) + ->entityType($entityType) + ->search() ); } } diff --git a/app/Rules/Location.php b/app/Rules/Location.php index 15821034cc..93bb883e84 100644 --- a/app/Rules/Location.php +++ b/app/Rules/Location.php @@ -2,7 +2,6 @@ namespace App\Rules; -use App\Facades\Module; use App\Models\EntityType; use Closure; use Illuminate\Contracts\Validation\ValidationRule; @@ -12,7 +11,7 @@ class Location implements ValidationRule /** * Run the validation rule. * - * @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail + * @param Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail */ public function validate(string $attribute, mixed $value, Closure $fail): void { @@ -26,7 +25,7 @@ public function validate(string $attribute, mixed $value, Closure $fail): void $fail(__('crud.dynamic.unknown', ['module' => $module->name()])); } - if (empty(trim($value))) { + if (empty(mb_trim($value))) { return; } diff --git a/app/Services/Search/LiveSearchService.php b/app/Services/Search/LiveSearchService.php index 6acc717a11..108d5c26b2 100644 --- a/app/Services/Search/LiveSearchService.php +++ b/app/Services/Search/LiveSearchService.php @@ -8,7 +8,6 @@ use App\Traits\EntityTypeAware; use App\Traits\RequestAware; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Http\Request; use Illuminate\Support\Str; class LiveSearchService diff --git a/app/View/Components/Forms/Foreign.php b/app/View/Components/Forms/Foreign.php index cc12bf2319..a22094a35b 100644 --- a/app/View/Components/Forms/Foreign.php +++ b/app/View/Components/Forms/Foreign.php @@ -4,7 +4,6 @@ use App\Facades\Module; use App\Models\Campaign; -use App\Models\Entity; use Closure; use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Model; diff --git a/routes/campaigns/campaign.php b/routes/campaigns/campaign.php index ba919da848..fd72770d4e 100644 --- a/routes/campaigns/campaign.php +++ b/routes/campaigns/campaign.php @@ -196,5 +196,5 @@ Route::get('/w/{campaign}/deletion', [App\Http\Controllers\Campaign\DeleteController::class, 'show'])->name('campaign.delete'); Route::delete('/w/{campaign}/destroy', [App\Http\Controllers\Campaign\DeleteController::class, 'destroy'])->name('campaigns.destroy'); -Route::get('/w/{campaign}/sidebar/image', [\App\Http\Controllers\Campaign\ImageController::class, 'index'])->name('campaign.sidebar.image'); -Route::post('/w/{campaign}/sidebar/image', [\App\Http\Controllers\Campaign\ImageController::class, 'save'])->name('campaign.sidebar.image-save'); +Route::get('/w/{campaign}/sidebar/image', [App\Http\Controllers\Campaign\ImageController::class, 'index'])->name('campaign.sidebar.image'); +Route::post('/w/{campaign}/sidebar/image', [App\Http\Controllers\Campaign\ImageController::class, 'save'])->name('campaign.sidebar.image-save'); diff --git a/routes/campaigns/search.php b/routes/campaigns/search.php index 9a8c467938..f239927820 100644 --- a/routes/campaigns/search.php +++ b/routes/campaigns/search.php @@ -5,7 +5,7 @@ // Old Search Route::get('/w/{campaign}/search', [App\Http\Controllers\SearchController::class, 'search'])->name('search'); -Route::get('/w/{campaign}/search/markers', [\App\Http\Controllers\Search\MarkerController::class, 'index'])->name('markers.find'); +Route::get('/w/{campaign}/search/markers', [App\Http\Controllers\Search\MarkerController::class, 'index'])->name('markers.find'); Route::get('/w/{campaign}/search/images', 'Search\ImageSearchController@index')->name('images.find'); Route::get('/w/{campaign}/search/members', 'Search\CampaignSearchController@members')->name('find.campaign.members'); @@ -24,7 +24,7 @@ Route::get('/w/{campaign}/search/months', 'Search\CalendarController@months')->name('search.calendar-months'); -Route::get('/w/{campaign}/search/type/{entity_type}', [\App\Http\Controllers\Search\ListController::class, 'index'])->name('search-list'); +Route::get('/w/{campaign}/search/type/{entity_type}', [App\Http\Controllers\Search\ListController::class, 'index'])->name('search-list'); Route::get('/w/{campaign}/search/live', [App\Http\Controllers\Search\LiveController::class, 'index'])->name('search.live'); Route::get('/w/{campaign}/search/recent', [App\Http\Controllers\Search\RecentController::class, 'index'])->name('search.recent');