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!

 
@@ -2437,6 +2437,7 @@ $LANG = array( 'online_payment_discount' => 'Online Payment Discount', 'created_new_company' => 'Successfully created new company', 'fees_disabled_for_gateway' => 'Fees are disabled for this gateway.', + 'logout_and_delete' => 'Log Out/Delete Account', ); diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 959fe1968a62..df27b0ab4b1e 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -23,7 +23,7 @@ } if (force || NINJA.isRegistered) { - window.location = '{{ URL::to('logout') }}'; + window.location = '{{ URL::to('logout') }}' + (force ? '?force_logout=true' : ''); } else { $('#logoutModal').modal('show'); } diff --git a/resources/views/partials/sign_up.blade.php b/resources/views/partials/sign_up.blade.php index 19e8b33a7aaa..6485edb45536 100644 --- a/resources/views/partials/sign_up.blade.php +++ b/resources/views/partials/sign_up.blade.php @@ -267,7 +267,7 @@ - + @@ -281,14 +281,18 @@

-
-

{{ trans('texts.are_you_sure') }}

+
+
+
+

{{ trans('texts.are_you_sure') }}


{{ trans('texts.erase_data') }}

+
+