Skip to content

Commit

Permalink
feat: improved delete account page
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Jun 25, 2024
1 parent e82f562 commit b1b759d
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 23 deletions.
8 changes: 6 additions & 2 deletions app/Livewire/BackupTasks/CreateBackupTaskForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ class CreateBackupTaskForm extends Component
public ?string $isolatedUsername = null;
public ?string $isolatedPassword = null;

public function updatedUseCustomCron(): void {}
public function updatedUseCustomCron(): void
{
}

public function updatedUseIsolatedCredentials(): void {}
public function updatedUseIsolatedCredentials(): void
{
}

public function updatedBackupType(): void
{
Expand Down
4 changes: 3 additions & 1 deletion app/Livewire/BackupTasks/UpdateBackupTaskForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class UpdateBackupTaskForm extends Component
public ?string $isolatedUsername = null;
public ?string $isolatedPassword = null;

public function updatedUseCustomCron(): void {}
public function updatedUseCustomCron(): void
{
}

public function updatedBackupType(): void
{
Expand Down
4 changes: 4 additions & 0 deletions resources/views/account/partials/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ class="pg:pb-0 scroll-hidden flex h-24 overflow-x-scroll px-8 pb-4 lg:block lg:h
@svg('heroicon-o-tag', 'h-5 w-5 mr-2 inline')
{{ __('Tags') }}
</x-sidebar-nav-link>
<x-sidebar-nav-link :href="route('account.remove-account')" :active="request()->routeIs('account.remove-account')" wire:navigate>
@svg('heroicon-o-trash', 'h-5 w-5 mr-2 inline')
{{ __('Remove Account') }}
</x-sidebar-nav-link>
</div>
7 changes: 7 additions & 0 deletions resources/views/account/remove-account.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-account-wrapper pageTitle="{{ __('Remove Account') }}">
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow-none sm:rounded-[0.70rem] border border-gray-950/5">
<div class="max-w-xl">
<livewire:profile.delete-user-form/>
</div>
</div>
</x-account-wrapper>
61 changes: 48 additions & 13 deletions resources/views/livewire/profile/delete-user-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,90 @@ public function deleteUser(Logout $logout): void
<section class="space-y-6">
<header>
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __('Delete Account') }}
{{ __('Remove Account') }}
</h2>

@if (Auth::user()->backupTasks->count() > 0)
<div class="py-2 px-4 bg-amber-50 text-amber-600 border-l-4 border-amber-600 font-normal my-6">
@svg('heroicon-o-exclamation-triangle', 'h-5 w-5 inline mr-2')
<span>
{{ __('Your scheduled tasks will not be ran if you remove your account.') }}
</span>
</div>
@endif

<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.') }}
{{ __('Before removing your account, please take a moment to download any data or information that you wish to retain.') }}
</p>
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
{{ __('Once your account is removed, all of its resources and data will be permanently removed. Additionally, all backup tasks, backup destinations, and linked servers will be removed from our systems.') }}
</p>
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
{{ __('These resources, such as S3 buckets or Linux servers, will still exist at their respective services (server hosts, Amazon S3, etc.). However, Vanguard will no longer be able to link to them and perform scheduled backups of your data.') }}
</p>
</header>

<x-danger-button
x-data=""
x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')"
>
{{ __('Delete Account') }}
{{ __('Remove Account') }}
</x-danger-button>

<a href="{{ route('overview') }}" wire:navigate>
<x-secondary-button class="ml-2">
{{ __('Get me out of here!') }}
</x-secondary-button>
</a>

<x-modal name="confirm-user-deletion" :show="$errors->isNotEmpty()" focusable>
<form wire:submit="deleteUser" class="p-6">

<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __('Are you sure you want to delete your account?') }}
{{ __('Are you certain you want to proceed with removing 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 class="mt-2 text-sm text-gray-600 dark:text-gray-400">
{{ __('When your account is removed, all the data we hold on you will be permanently erased. This includes any backup tasks, backup destinations you have configured with us, and servers you have linked.') }}
</p>

<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
{{ __('This action cannot be reversed, so please make sure you are certain about this decision.') }}
</p>

<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
{{ __('You are welcome to re-join at any time.') }}
</p>

<p class="mt-3 text-sm text-gray-800 dark:text-gray-600 font-medium">
{{ __('If you wish to proceed, please enter your account password to confirm.') }}
</p>

<div class="mt-6">
<x-input-label for="password" value="{{ __('Password') }}" class="sr-only" />
<x-input-label for="password" value="{{ __('Your Password:') }}" />

<x-text-input
wire:model="password"
id="password"
name="password"
type="password"
class="mt-1 block w-3/4"
class="mt-2 block w-full"
placeholder="{{ __('Password') }}"
/>

<x-input-error :messages="$errors->get('password')" class="mt-2" />
<x-input-explain>
{{ __('To continue with the removal of your account, please enter the password associated with your account. If you do not know, you can reset your password.') }}
</x-input-explain>
</div>

<div class="mt-6 flex justify-end">
<x-secondary-button x-on:click="$dispatch('close')">
<x-danger-button>
{{ __('Remove Account') }}
</x-danger-button>
<x-secondary-button x-on:click="$dispatch('close')" class="ms-3">
{{ __('Cancel') }}
</x-secondary-button>

<x-danger-button class="ms-3">
{{ __('Delete Account') }}
</x-danger-button>
</div>
</form>
</x-modal>
Expand Down
6 changes: 0 additions & 6 deletions resources/views/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
<livewire:profile.update-password-form/>
</div>
</div>

<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow-none sm:rounded-[0.70rem] border border-gray-950/5">
<div class="max-w-xl">
<livewire:profile.delete-user-form/>
</div>
</div>
</div>
</div>
</x-account-wrapper>
5 changes: 5 additions & 0 deletions routes/breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
$trail->push(__('Profile'), route('profile'));
});

Breadcrumbs::for('account.remove-account', function (BreadcrumbTrail $trail) {
$trail->parent('profile');
$trail->push(__('Remove Account'), route('account.remove-account'));
});

Breadcrumbs::for('backup-tasks.index', function (BreadcrumbTrail $trail) {
$trail->push(__('Backup Tasks'), route('backup-tasks.index'));
});
Expand Down
4 changes: 4 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
->middleware(['auth'])
->name('profile');

Route::view('profile/remove', 'account.remove-account')
->middleware(['auth'])
->name('account.remove-account');

Route::view('frequently-asked-questions', 'frequently-asked-questions')
->middleware(['auth'])
->name('frequently-asked-questions');
Expand Down
13 changes: 12 additions & 1 deletion tests/Feature/Profile/ProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
$response
->assertOk()
->assertSeeVolt('profile.update-profile-information-form')
->assertSeeVolt('profile.update-password-form')
->assertSeeVolt('profile.update-password-form');
});

test('delete page is displayed', function () {
$user = User::factory()->create();

$this->actingAs($user);

$response = $this->get('/profile/remove');

$response
->assertOk()
->assertSeeVolt('profile.delete-user-form');
});

Expand Down

0 comments on commit b1b759d

Please sign in to comment.