From 74b680ef872d76dbf92001d05bbe565b83c0047d Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 14 Sep 2014 15:26:51 +0300 Subject: [PATCH] Added the ability to cancel an account --- app/controllers/AccountController.php | 10 ++++ app/lang/de/texts.php | 11 ++-- app/lang/en/texts.php | 9 +++- app/lang/es/texts.php | 11 ++-- app/lang/fr/texts.php | 11 ++-- app/lang/it/texts.php | 9 +++- app/lang/lt/texts.php | 8 ++- app/lang/nb_NO/texts.php | 9 +++- app/lang/nl/texts.php | 9 +++- app/lang/pt_BR/texts.php | 9 +++- app/routes.php | 1 + app/views/accounts/import_export.blade.php | 63 ++++++++++++++++++---- app/views/invoices/edit.blade.php | 2 +- 13 files changed, 130 insertions(+), 32 deletions(-) diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 44d215ffbfd8..c342d6986dd4 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -815,4 +815,14 @@ class AccountController extends \BaseController { return "{$user->first_name} {$user->last_name}"; } + + public function cancelAccount() + { + $account = Auth::user()->account; + $account->forceDelete(); + + Confide::logout(); + + return Redirect::to('/')->with('clearGuestKey', true); + } } \ No newline at end of file diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index 77fc2f781a89..f2f89bea2d06 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -405,7 +405,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', - + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', + ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index a3ee84c2aa6d..25a3c16f7c97 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -420,8 +420,13 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', ); \ No newline at end of file diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 466d11ff783a..2335ce1c3afd 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -403,7 +403,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', - + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', + ); diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index ea725a138084..462785a93869 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -405,7 +405,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', - + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', + ); diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index f1d958b94712..c81c33eab1cd 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -405,7 +405,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', ); diff --git a/app/lang/lt/texts.php b/app/lang/lt/texts.php index 109f66f804eb..d6e5a05821ba 100644 --- a/app/lang/lt/texts.php +++ b/app/lang/lt/texts.php @@ -420,9 +420,13 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', ); diff --git a/app/lang/nb_NO/texts.php b/app/lang/nb_NO/texts.php index d62734c9fbf8..abed26d260a7 100644 --- a/app/lang/nb_NO/texts.php +++ b/app/lang/nb_NO/texts.php @@ -420,7 +420,12 @@ return array( 'deleted_user' => 'Bruker slettet', 'limit_users' => 'Dessverre, vil dette overstiger grensen på ' . MAX_NUM_USERS . ' brukere', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', ); \ No newline at end of file diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index 8f9ea67de15a..5ad10e249578 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -406,7 +406,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', + ); diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index 738a73b7d1ac..5aab09b6b887 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -394,7 +394,12 @@ return array( 'deleted_user' => 'Successfully deleted user', 'limit_users' => 'Sorry, this will exceed the limit of ' . MAX_NUM_USERS . ' users', - 'confirm_email_invoice' => 'Confirm emailing this invoice', - 'confirm_email_quote' => 'Confirm emailing this quote', + 'confirm_email_invoice' => 'Are you sure you want to email this invoice?', + 'confirm_email_quote' => 'Are you sure you want to email this quote?', + 'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?', + 'cancel_account' => 'Cancel Account', + 'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.', + 'go_back' => 'Go Back', + ); diff --git a/app/routes.php b/app/routes.php index e7271bf1f429..489ad1c57191 100755 --- a/app/routes.php +++ b/app/routes.php @@ -81,6 +81,7 @@ Route::group(array('before' => 'auth'), function() Route::get('company/advanced_settings/chart_builder', 'ReportController@report'); Route::post('company/advanced_settings/chart_builder', 'ReportController@report'); + Route::post('company/cancel_account', 'AccountController@cancelAccount'); Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData')); Route::get('company/{section?}/{sub_section?}', 'AccountController@showSection'); Route::post('company/{section?}/{sub_section?}', 'AccountController@doSection'); diff --git a/app/views/accounts/import_export.blade.php b/app/views/accounts/import_export.blade.php index e9a72ee1b2cd..fd802d177632 100755 --- a/app/views/accounts/import_export.blade.php +++ b/app/views/accounts/import_export.blade.php @@ -1,17 +1,60 @@ @extends('accounts.nav') @section('content') - @parent +@parent - {{ Former::open_for_files('company/import_map')->addClass('col-md-9 col-md-offset-1') }} - {{ Former::legend('import_clients') }} - {{ Former::file('file')->label(trans('texts.csv_file')) }} - {{ Former::actions( Button::lg_info_submit(trans('texts.upload'))->append_with_icon('open') ) }} - {{ Former::close() }} +{{ Former::open_for_files('company/import_map')->addClass('col-md-9 col-md-offset-1') }} +{{ Former::legend('import_clients') }} +{{ Former::file('file')->label(trans('texts.csv_file')) }} +{{ Former::actions( Button::lg_info_submit(trans('texts.upload'))->append_with_icon('open') ) }} +{{ Former::close() }} - {{ Former::open('company/export')->addClass('col-md-9 col-md-offset-1') }} - {{ Former::legend('export_clients') }} - {{ Former::actions( Button::lg_primary_submit(trans('texts.download'))->append_with_icon('download-alt') ) }} - {{ Former::close() }} +{{ Former::open('company/export')->addClass('col-md-9 col-md-offset-1') }} +{{ Former::legend('export_clients') }} +{{ Former::actions( Button::lg_primary_submit(trans('texts.download'))->append_with_icon('download-alt') ) }} +{{ Former::close() }} + +

 

+

 

+ +{{ Former::open('company/cancel_account')->addClass('col-md-9 col-md-offset-1 cancel-account') }} +{{ Former::legend('cancel_account') }} +{{ Former::actions( Button::lg_danger_button(trans('texts.cancel_account'), ['onclick' => 'showConfirm()'])->append_with_icon('trash') ) }} + + + +{{ Former::close() }} + + + @stop \ No newline at end of file diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index 2d634a7687f9..f0d72ebe9729 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -730,7 +730,7 @@ function onSaveClick() { if (model.invoice().is_recurring()) { - if (confirm('{{ trans("texts.confirm_email_$entityType") }}')) { + if (confirm('{{ trans("texts.confirm_recurring_email_$entityType") }}')) { submitAction(''); } } else {