feat: remove old code
This commit is contained in:
parent
d49c43f209
commit
b3784b77b1
@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Livewire\Attributes\Rule;
|
|
||||||
use Livewire\Volt\Component;
|
|
||||||
|
|
||||||
new class extends Component
|
|
||||||
{
|
|
||||||
#[Rule(['required', 'string', 'current_password'])]
|
|
||||||
public string $password = '';
|
|
||||||
|
|
||||||
public function deleteUser(): void
|
|
||||||
{
|
|
||||||
$this->validate();
|
|
||||||
|
|
||||||
tap(auth()->user(), fn () => auth()->logout())->delete();
|
|
||||||
|
|
||||||
session()->invalidate();
|
|
||||||
session()->regenerateToken();
|
|
||||||
|
|
||||||
$this->redirect('/', navigate: true);
|
|
||||||
}
|
|
||||||
}; ?>
|
|
||||||
|
|
||||||
<section class="space-y-6">
|
|
||||||
<header>
|
|
||||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
|
||||||
{{ __('Delete Account') }}
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
||||||
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }}
|
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<x-danger-button
|
|
||||||
x-data=""
|
|
||||||
x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')"
|
|
||||||
>{{ __('Delete Account') }}</x-danger-button>
|
|
||||||
|
|
||||||
<x-modal name="confirm-user-deletion" :show="$errors->isNotEmpty()" focusable>
|
|
||||||
<form wire:submit="deleteUser" class="p-6">
|
|
||||||
|
|
||||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
|
||||||
{{ __('Are you sure you want to delete your account?') }}
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
||||||
{{ __('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.') }}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="mt-6">
|
|
||||||
<x-input-label for="password" value="{{ __('Password') }}" class="sr-only" />
|
|
||||||
|
|
||||||
<x-text-input
|
|
||||||
wire:model="password"
|
|
||||||
id="password"
|
|
||||||
name="password"
|
|
||||||
type="password"
|
|
||||||
class="mt-1 block w-3/4"
|
|
||||||
placeholder="{{ __('Password') }}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<x-input-error :messages="$errors->get('password')" class="mt-2" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-6 flex justify-end">
|
|
||||||
<x-secondary-button x-on:click="$dispatch('close')">
|
|
||||||
{{ __('Cancel') }}
|
|
||||||
</x-secondary-button>
|
|
||||||
|
|
||||||
<x-danger-button class="ml-3">
|
|
||||||
{{ __('Delete Account') }}
|
|
||||||
</x-danger-button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</x-modal>
|
|
||||||
</section>
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
use Livewire\Volt\Component;
|
|
||||||
|
|
||||||
new class extends Component
|
|
||||||
{
|
|
||||||
public string $firstname = '';
|
|
||||||
public string $lastname = '';
|
|
||||||
public string $email = '';
|
|
||||||
|
|
||||||
public function mount(): void
|
|
||||||
{
|
|
||||||
$this->firstname = auth()->user()->firstname;
|
|
||||||
$this->lastname = auth()->user()->lastname;
|
|
||||||
$this->email = auth()->user()->email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateProfileInformation(): void
|
|
||||||
{
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
$validated = $this->validate([
|
|
||||||
'firstname' => ['required', 'string', 'max:255'],
|
|
||||||
'lastname' => ['required', 'string', 'max:255'],
|
|
||||||
'email' => ['required', 'email', 'max:255', Rule::unique(User::class)->ignore($user->id)],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user->fill($validated);
|
|
||||||
|
|
||||||
if ($user->isDirty('email')) {
|
|
||||||
$user->email_verified_at = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->save();
|
|
||||||
|
|
||||||
$this->dispatch('profile-updated', name: $user->name);
|
|
||||||
}
|
|
||||||
}; ?>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<header>
|
|
||||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
|
||||||
{{ __('Profile Information') }}
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
||||||
{{ __("Update your account's profile information and email address.") }}
|
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<form wire:submit="updateProfileInformation" class="mt-6 space-y-6">
|
|
||||||
<div>
|
|
||||||
<x-input-label for="firstname" :value="__('FirstName')" />
|
|
||||||
<x-text-input wire:model="firstname" id="firstname" name="firstname" type="text" class="mt-1 block w-full" required autofocus autocomplete="first" />
|
|
||||||
<x-input-error class="mt-2" :messages="$errors->get('firstname')" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<x-input-label for="lastname" :value="__('lastname')" />
|
|
||||||
<x-text-input wire:model="lastname" id="lastname" name="lastname" type="text" class="mt-1 block w-full" required autofocus autocomplete="last" />
|
|
||||||
<x-input-error class="mt-2" :messages="$errors->get('lastname')" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<x-input-label for="email" :value="__('Email')" />
|
|
||||||
<x-text-input wire:model="email" id="email" name="email" type="email" class="mt-1 block w-full" required autocomplete="username" />
|
|
||||||
<x-input-error class="mt-2" :messages="$errors->get('email')" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50">{{ __('Save') }}</x-primary-button>
|
|
||||||
|
|
||||||
<x-action-message class="mr-3" on="profile-updated">
|
|
||||||
{{ __('Saved.') }}
|
|
||||||
</x-action-message>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
@ -7,23 +7,11 @@
|
|||||||
|
|
||||||
<div class="py-12">
|
<div class="py-12">
|
||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||||
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
|
|
||||||
{{-- <div class="max-w-xl">--}}
|
|
||||||
{{-- <livewire:profile.update-profile-information-form />--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
|
|
||||||
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
|
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
|
||||||
<div class="max-w-xl">
|
<div class="max-w-xl">
|
||||||
<livewire:profile.update-password-form />
|
<livewire:profile.update-password-form />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
|
|
||||||
{{-- <div class="max-w-xl">--}}
|
|
||||||
{{-- <livewire:profile.delete-user-form />--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</x-app-layout>
|
</x-app-layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user