Merge pull request #3974 from coollabsio/fix-backup-deletion

Fix: Disable tow step confirmation when there is a password throws and error
This commit is contained in:
Andras Bacsai
2024-10-22 13:43:33 +02:00
committed by GitHub
10 changed files with 56 additions and 29 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Livewire\Server;
use App\Actions\Server\DeleteServer;
use App\Models\InstanceSettings;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
@@ -16,10 +17,12 @@ class Delete extends Component
public function delete($password)
{
if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
if (! InstanceSettings::get('disable_two_step_confirmation')) {
if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return;
return;
}
}
try {
$this->authorize('delete', $this->server);