presseportale/resources/views/livewire/settings/delete-user-form.blade.php
Kevin Adametz 9b47296cea
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Rebrand Hub+Flux
2026-05-20 15:44:15 +02:00

70 lines
2.7 KiB
PHP

<?php
use App\Livewire\Actions\Logout;
use Illuminate\Support\Facades\Auth;
use Livewire\Volt\Component;
new class extends Component
{
public string $password = '';
/**
* Delete the currently authenticated user.
*/
public function deleteUser(Logout $logout): void
{
$this->validate([
'password' => ['required', 'string', 'current_password'],
]);
tap(Auth::user(), $logout(...))->forceDelete();
$this->redirect('/', navigate: true);
}
}; ?>
<section>
<div class="rounded-[6px] border-l-[3px] border-l-[color:var(--color-err)] border-[color:var(--color-bg-rule)] border bg-[color:var(--color-err-soft)]/30 p-5">
<div class="text-[11px] uppercase tracking-[0.6px] font-semibold text-[color:var(--color-err)] mb-2">
{{ __('Danger Zone') }}
</div>
<div class="flex items-start justify-between gap-4 flex-wrap">
<div class="min-w-0 flex-1">
<h3 class="text-[14px] font-semibold text-[color:var(--color-ink)] m-0">
{{ __('Delete account') }}
</h3>
<p class="text-[12.5px] text-[color:var(--color-ink-2)] mt-1 m-0">
{{ __('Delete your account and all of its resources') }}
</p>
</div>
<flux:modal.trigger name="confirm-user-deletion">
<flux:button variant="danger" icon="trash" x-data="" x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')">
{{ __('Delete account') }}
</flux:button>
</flux:modal.trigger>
</div>
</div>
<flux:modal name="confirm-user-deletion" :show="$errors->isNotEmpty()" focusable class="max-w-lg">
<form wire:submit="deleteUser" class="space-y-6">
<div>
<flux:heading size="lg">{{ __('Are you sure you want to delete your account?') }}</flux:heading>
<flux:subheading>
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }}
</flux:subheading>
</div>
<flux:input wire:model="password" :label="__('Password')" type="password" />
<div class="flex justify-end space-x-2 rtl:space-x-reverse">
<flux:modal.close>
<flux:button variant="filled">{{ __('Cancel') }}</flux:button>
</flux:modal.close>
<flux:button variant="danger" type="submit">{{ __('Delete account') }}</flux:button>
</div>
</form>
</flux:modal>
</section>