diff --git a/app/Livewire/NavbarDeleteTeam.php b/app/Livewire/NavbarDeleteTeam.php index 2c45de269..10ba0c86a 100644 --- a/app/Livewire/NavbarDeleteTeam.php +++ b/app/Livewire/NavbarDeleteTeam.php @@ -19,7 +19,7 @@ class NavbarDeleteTeam extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.php index d356d739c..016218b78 100644 --- a/app/Livewire/Project/Database/BackupEdit.php +++ b/app/Livewire/Project/Database/BackupEdit.php @@ -59,7 +59,7 @@ class BackupEdit extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Database/BackupExecutions.php b/app/Livewire/Project/Database/BackupExecutions.php index 30c01fc3d..d7ac18097 100644 --- a/app/Livewire/Project/Database/BackupExecutions.php +++ b/app/Livewire/Project/Database/BackupExecutions.php @@ -42,7 +42,7 @@ class BackupExecutions extends Component public function deleteBackup($executionId, $password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.php index 2b6f18ec2..4d070bc0c 100644 --- a/app/Livewire/Project/Service/FileStorage.php +++ b/app/Livewire/Project/Service/FileStorage.php @@ -88,7 +88,7 @@ class FileStorage extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Service/ServiceApplicationView.php b/app/Livewire/Project/Service/ServiceApplicationView.php index 22d4cf4cb..8324ee645 100644 --- a/app/Livewire/Project/Service/ServiceApplicationView.php +++ b/app/Livewire/Project/Service/ServiceApplicationView.php @@ -50,7 +50,7 @@ class ServiceApplicationView extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.php index c7aad89ef..2a21532ce 100644 --- a/app/Livewire/Project/Shared/Danger.php +++ b/app/Livewire/Project/Shared/Danger.php @@ -92,7 +92,7 @@ class Danger extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Shared/Destination.php b/app/Livewire/Project/Shared/Destination.php index 1e872c60a..c305e817c 100644 --- a/app/Livewire/Project/Shared/Destination.php +++ b/app/Livewire/Project/Shared/Destination.php @@ -119,7 +119,7 @@ class Destination extends Component public function removeServer(int $network_id, int $server_id, $password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Project/Shared/Storages/Show.php b/app/Livewire/Project/Shared/Storages/Show.php index 4c9303033..54b1be3af 100644 --- a/app/Livewire/Project/Shared/Storages/Show.php +++ b/app/Livewire/Project/Shared/Storages/Show.php @@ -41,7 +41,7 @@ class Show extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Server/Delete.php b/app/Livewire/Server/Delete.php index 606977b20..cc2b335e1 100644 --- a/app/Livewire/Server/Delete.php +++ b/app/Livewire/Server/Delete.php @@ -17,7 +17,7 @@ class Delete extends Component public function delete($password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php index 9747329f6..938d0e548 100644 --- a/app/Livewire/Settings/Index.php +++ b/app/Livewire/Settings/Index.php @@ -5,6 +5,8 @@ namespace App\Livewire\Settings; use App\Jobs\CheckForUpdatesJob; use App\Models\InstanceSettings; use App\Models\Server; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Hash; use Livewire\Component; class Index extends Component @@ -185,8 +187,14 @@ class Index extends Component return view('livewire.settings.index'); } - public function toggleTwoStepConfirmation() + public function toggleTwoStepConfirmation($password) { + if (! Hash::check($password, Auth::user()->password)) { + $this->addError('password', 'The provided password is incorrect.'); + + return; + } + $this->settings->disable_two_step_confirmation = true; $this->settings->save(); $this->disable_two_step_confirmation = true; diff --git a/app/Livewire/Team/AdminView.php b/app/Livewire/Team/AdminView.php index 25af875bb..700c30f0a 100644 --- a/app/Livewire/Team/AdminView.php +++ b/app/Livewire/Team/AdminView.php @@ -78,7 +78,7 @@ class AdminView extends Component public function delete($id, $password) { - if (! InstanceSettings::get('disable_two_step_confirmation')) { + if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) { if (! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.');