diff --git a/resources/views/livewire/profile/delete-user-form.blade.php b/resources/views/livewire/profile/delete-user-form.blade.php index 76966ab5..25365f8a 100644 --- a/resources/views/livewire/profile/delete-user-form.blade.php +++ b/resources/views/livewire/profile/delete-user-form.blade.php @@ -1,25 +1,107 @@ isLoading = true; + $this->checkEligibility(); + $this->generateAccountSummary(); + $this->checkPassword(); + } + + /** + * Check if the user is eligible for account deletion + */ + private function checkEligibility(): void + { + /** @var User $user */ + $user = Auth::user(); + $this->isEligible = $user->backupTasks()->count() === 0 && + $user->remoteServers()->count() === 0 && + $user->backupDestinations()->count() === 0; + } + + /** + * Generate a summary of the user's account data + */ + private function generateAccountSummary(): void + { + /** @var User $user */ + $user = Auth::user(); + $this->accountSummary = [ + 'backupTasks' => $user->backupTasks()->count(), + 'remoteServers' => $user->remoteServers()->count(), + 'backupDestinations' => $user->backupDestinations()->count(), + ]; } + /** + * Check if the user has set a password + */ + private function checkPassword(): void + { + /** @var User $user */ + $user = Auth::user(); + $this->hasPassword = !is_null($user->password); + } + + /** + * Proceed to the eligibility check view + */ + public function proceedToEligibilityCheck(): void + { + $this->currentView = 'eligibility'; + } + + /** + * Proceed to the final confirmation view if eligible + */ + public function proceedToFinalConfirmation(): void + { + if ($this->isEligible) { + $this->currentView = 'final-confirmation'; + } + } + + /** + * Delete the user's account + * + * @param Logout $logout + */ public function deleteUser(Logout $logout): void { $this->validate([ 'password' => ['required', 'string', 'current_password'], - ], [ - 'password.required' => __('Please enter your password.'), - 'password.current_password' => __('The password you have entered is incorrect. Please try again.') ]); tap(Auth::user(), $logout(...))->delete(); @@ -29,126 +111,145 @@ public function deleteUser(Logout $logout): void }; ?>
+ {{ __('Deleting your account is a permanent action. Please consider the following consequences:') }} +
+- {{ __('Before removing your account, please take a moment to download any data or information that you wish to retain.') }} -
-- {{ __('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.') }} -
-- {{ __('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.') }} -
- - -