Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add password confirmation to disable two step confirmation

peaklabs-dev8284cdfb02e7
diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
index 7d3fe62a72..0636e592e4 100644
--- a/app/Livewire/Settings/Index.php
+++ b/app/Livewire/Settings/Index.php
@@ -152,7 +152,6 @@ class Index extends Component
$this->settings->is_api_enabled = $this->is_api_enabled;
$this->settings->auto_update_frequency = $this->auto_update_frequency;
$this->settings->update_check_frequency = $this->update_check_frequency;
- $this->settings->disable_two_step_confirmation = $this->disable_two_step_confirmation;
$this->settings->save();
$this->server->setupDynamicProxyConfiguration();
if (! $error_show) {
@@ -186,4 +185,12 @@ class Index extends Component
{
return view('livewire.settings.index');
}
+
+ public function toggleTwoStepConfirmation()
+ {
+ $this->settings->disable_two_step_confirmation = true;
+ $this->settings->save();
+ $this->disable_two_step_confirmation = true;
+ $this->dispatch('success', 'Two step confirmation has been disabled.');
+ }
}
diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php
index db2a069957..b8874cbac4 100644
--- a/resources/views/livewire/settings/index.blade.php
+++ b/resources/views/livewire/settings/index.blade.php
@@ -111,7 +111,21 @@
<p class="font-bold">Warning!</p>
<p>Disabling two-step confirmation reduces security (as anyone can easily delete anything) and increases the risk of accidental actions. This is not recommended for production servers.</p>
</div>
- <x-forms.checkbox instantSave id="disable_two_step_confirmation" label="Disable Two Step Confirmation" helper="When disabled, you will not need to confirm actions with a text and user password. This significantly reduces security and may lead to accidental deletions or unwanted changes. Use with extreme caution, especially on production servers." />
+ @if($disable_two_step_confirmation)
+ <x-forms.checkbox instantSave id="disable_two_step_confirmation" label="Disable Two Step Confirmation" helper="When disabled, you will not need to confirm actions with a text and user password. This significantly reduces security and may lead to accidental deletions or unwanted changes. Use with extreme caution, especially on production servers." />
+ @else
+ <x-modal-confirmation
+ title="Disable Two Step Confirmation?"
+ buttonTitle="Disable Two Step Confirmation"
+ isErrorButton
+ submitAction="toggleTwoStepConfirmation"
+ :actions="['Tow Step confimation will be disabled globally.', 'Disabling two-step confirmation reduces security (as anyone can easily delete anything).', 'The risk of accidental actions will increase.']"
+ confirmationText="DISABLE TWO STEP CONFIRMATION"
+ confirmationLabel="Please type the confirmation text to disable two step confirmation."
+ shortConfirmationLabel="Type Confirmation Text"
+ step3ButtonText="Disable Two Step Confirmation"
+ />
+ @endif
</div>
</div>
</form>