diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index c5fbccb78790..efe471557917 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -173,13 +173,17 @@ class AuthController extends Controller public function getLogoutWrapper() { if (Auth::check() && ! Auth::user()->registered) { - $account = Auth::user()->account; - $this->accountRepo->unlinkAccount($account); + if (request()->force_logout) { + $account = Auth::user()->account; + $this->accountRepo->unlinkAccount($account); - if (! $account->hasMultipleAccounts()) { - $account->company->forceDelete(); + if (! $account->hasMultipleAccounts()) { + $account->company->forceDelete(); + } + $account->forceDelete(); + } else { + return redirect('/'); } - $account->forceDelete(); } $response = self::getLogout(); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index a70148f7ba76..47d2c10b70e1 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -266,7 +266,7 @@ $LANG = array( 'working' => 'Working', 'success' => 'Success', 'success_message' => 'You have successfully registered! Please visit the link in the account confirmation email to verify your email address.', - 'erase_data' => 'This will permanently erase your data.', + 'erase_data' => 'Your account is not registered, this will permanently erase your data.', 'password' => 'Password', 'pro_plan_product' => 'Pro Plan', 'pro_plan_success' => 'Thanks for choosing Invoice Ninja\'s Pro plan!
{{ trans('texts.erase_data') }}