diff --git a/app/Livewire/Project/Shared/Storages/VolumeBackups.php b/app/Livewire/Project/Shared/Storages/VolumeBackups.php index d16a5e2c8..a378101b8 100644 --- a/app/Livewire/Project/Shared/Storages/VolumeBackups.php +++ b/app/Livewire/Project/Shared/Storages/VolumeBackups.php @@ -206,7 +206,7 @@ public function delete(?string $password = null, array $selectedActions = []) { $this->authorize('update', $this->resource); - if (! $password || ! verifyPasswordConfirmation($password, $this)) { + if (! verifyPasswordConfirmation($password, $this)) { return 'The provided password is incorrect.'; } diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.php index 17194a187..7e8ee0c21 100644 --- a/tests/Feature/VolumeBackupTest.php +++ b/tests/Feature/VolumeBackupTest.php @@ -1151,6 +1151,23 @@ function signInForVolumeBackups($testCase, Team $team): User && str_contains($process->command, 'archive.tar.gz')); }); +it('deletes a volume backup schedule without a password when two-step confirmation is disabled', function () { + $team = Team::factory()->create(); + signInForVolumeBackups($this, $team); + [$application, $volume] = createVolumeBackupApplication($team); + InstanceSettings::get()->update(['disable_two_step_confirmation' => true]); + $backup = $volume->scheduledBackups()->create([ + 'team_id' => $team->id, + 'frequency' => 'daily', + ]); + + Livewire::test(VolumeBackups::class, ['storage' => $volume, 'resource' => $application]) + ->call('delete', '') + ->assertDispatched('success'); + + expect($backup->fresh())->toBeNull(); +}); + it('deletes S3 archives from the storage recorded on each execution', function () { $team = Team::factory()->create(); signInForVolumeBackups($this, $team);