Add extra logout delete check

This commit is contained in:
Hillel Coren 2017-03-24 16:44:01 +03:00
parent 7bb6a7945a
commit b680891929
4 changed files with 20 additions and 11 deletions

View File

@ -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();

View File

@ -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!<p/>&nbsp;<br/>
@ -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',
);

View File

@ -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');
}

View File

@ -267,7 +267,7 @@
<button type="button" class="btn btn-default" id="closeSignUpButton" data-dismiss="modal">{{ trans('texts.close') }} <i class="glyphicon glyphicon-remove-circle"></i></button>
<button type="button" class="btn btn-primary" id="saveSignUpButton" onclick="validateServerSignUp()" disabled>{{ trans('texts.save') }} <i class="glyphicon glyphicon-floppy-disk"></i></button>
</div>
</div>
</div>
</div>
</div>
@ -281,14 +281,18 @@
<h4 class="modal-title" id="myModalLabel">{{ trans('texts.logout') }}</h4>
</div>
<div class="container">
<h3>{{ trans('texts.are_you_sure') }}</h3>
<div class="container" style="width: 100%; padding-bottom: 0px !important">
<div class="panel panel-default" style="margin-bottom: 2px">
<div class="panel-body">
<h3>{{ trans('texts.are_you_sure') }}</h3><br/>
<p>{{ trans('texts.erase_data') }}</p>
</div>
</div>
</div>
<div class="modal-footer" id="signUpFooter">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
<button type="button" class="btn btn-danger" onclick="logout(true)">{{ trans('texts.logout') }}</button>
<button type="button" class="btn btn-danger" onclick="logout(true)">{{ trans('texts.logout_and_delete') }}</button>
</div>
</div>
</div>