From 3556871fa9905a33def67e117fc8bafa7e2c8c31 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 4 Mar 2015 23:53:46 +0200 Subject: [PATCH] =?UTF-8?q?Added=20support=20for=20changing=20user?= =?UTF-8?q?=E2=80=99s=20password?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/UserController.php | 26 +++++ app/filters.php | 1 + app/lang/da/texts.php | 11 ++- app/lang/de/texts.php | 7 ++ app/lang/en/texts.php | 11 ++- app/lang/es/texts.php | 12 ++- app/lang/fr/texts.php | 12 ++- app/lang/it/texts.php | 12 ++- app/lang/lt/texts.php | 12 ++- app/lang/nb_NO/texts.php | 21 +++- app/lang/nl/texts.php | 12 ++- app/lang/pt_BR/texts.php | 12 ++- app/routes.php | 1 + app/views/accounts/details.blade.php | 141 +++++++++++++++++++++++++++ app/views/accounts/nav.blade.php | 3 +- composer.json | 20 ++-- 16 files changed, 285 insertions(+), 29 deletions(-) diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 931eae529052..85fff4f86da3 100755 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -478,4 +478,30 @@ class UserController extends BaseController return Redirect::to('/')->with('clearGuestKey', true); } + + public function changePassword() + { + // check the current password is correct + if (!Auth::validate([ + 'email' => Auth::user()->email, + 'password' => Input::get('current_password') + ])) { + return trans('texts.password_error_incorrect'); + } + + // validate the new password + $password = Input::get('new_password'); + $confirm = Input::get('confirm_password'); + + if (strlen($password) < 6 || $password != $confirm) { + return trans('texts.password_error_invalid'); + } + + // save the new password + $user = Auth::user(); + $user->password = $password; + $user->save(); + + return RESULT_SUCCESS; + } } diff --git a/app/filters.php b/app/filters.php index db20fa951eb8..b374723a64b3 100755 --- a/app/filters.php +++ b/app/filters.php @@ -184,6 +184,7 @@ Route::filter('api.access', function() Auth::loginUsingId($token->user_id); Session::set('token_id', $token->id); } else { + sleep(3); return Response::make('Invalid token', 403, $headers); } diff --git a/app/lang/da/texts.php b/app/lang/da/texts.php index 23612c3fe0ac..5f6f867cc4ab 100644 --- a/app/lang/da/texts.php +++ b/app/lang/da/texts.php @@ -466,7 +466,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', @@ -532,7 +532,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -559,6 +559,13 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', ); diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index fbf2a618ddc9..9d3829fda9ad 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -549,6 +549,13 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index 646154ebdf80..7d06c89a6f4e 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -464,7 +464,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', @@ -530,7 +530,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -557,5 +557,12 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', ); diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index c13074f2d8f8..f400c21b21bd 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -435,7 +435,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', @@ -502,7 +502,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -529,5 +529,13 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); \ No newline at end of file diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 40d55c761fce..36ca7b9c7311 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -456,7 +456,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Numéro de TVA', @@ -523,7 +523,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -550,5 +550,13 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); \ No newline at end of file diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 30032642df30..b3772a45764d 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -457,7 +457,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -525,7 +525,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -552,5 +552,13 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/lang/lt/texts.php b/app/lang/lt/texts.php index 0707cbc6f934..d144838b8ddd 100644 --- a/app/lang/lt/texts.php +++ b/app/lang/lt/texts.php @@ -466,7 +466,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -533,7 +533,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -560,6 +560,14 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/lang/nb_NO/texts.php b/app/lang/nb_NO/texts.php index 25a3109460db..e1efa117ccae 100644 --- a/app/lang/nb_NO/texts.php +++ b/app/lang/nb_NO/texts.php @@ -464,7 +464,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -531,7 +531,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -549,5 +549,22 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); \ No newline at end of file diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index 36a7027cc966..d4d233db6248 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -458,7 +458,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -526,7 +526,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -553,6 +553,14 @@ return array( 'pay_with_paypal' => 'PayPal', 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); \ No newline at end of file diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index 531f8a3e94a8..9fcd74d41adc 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -446,7 +446,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -513,7 +513,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -541,5 +541,13 @@ return array( 'pay_with_card' => 'Credit card', + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/routes.php b/app/routes.php index 8b1641314e28..fc436e177b86 100755 --- a/app/routes.php +++ b/app/routes.php @@ -81,6 +81,7 @@ Route::group(array('before' => 'auth'), function() { Route::post('users/delete', 'UserController@delete'); Route::get('send_confirmation/{user_id}', 'UserController@sendConfirmation'); Route::get('restore_user/{user_id}', 'UserController@restoreUser'); + Route::post('users/change_password', 'UserController@changePassword'); Route::get('api/tokens', array('as'=>'api.tokens', 'uses'=>'TokenController@getDatatable')); Route::resource('tokens', 'TokenController'); diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index c92a41cea0d3..7dd89ec9d428 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -66,6 +66,7 @@ {{ Former::text('last_name') }} {{ Former::text('email') }} {{ Former::text('phone') }} + {{ Former::actions(Button::primary_sm(trans('texts.change_password'), ['onclick'=>'showChangePassword()'])); }} @endif {{ Former::legend('localization') }} @@ -88,16 +89,85 @@ {{ Button::lg_success_submit(trans('texts.save'))->append_with_icon('floppy-disk') }} + + + + {{ Former::close() }} {{ Form::open(['url' => 'remove_logo', 'class' => 'removeLogoForm']) }} {{ Form::close() }} + + + @stop \ No newline at end of file diff --git a/app/views/accounts/nav.blade.php b/app/views/accounts/nav.blade.php index 1aec91d426a5..5967295ffa9e 100755 --- a/app/views/accounts/nav.blade.php +++ b/app/views/accounts/nav.blade.php @@ -10,6 +10,7 @@ {{ HTML::nav_link('company/import_export', 'import_export', 'company/import_map') }} {{ HTML::nav_link('company/advanced_settings/invoice_settings', 'advanced_settings', '*/advanced_settings/*') }} -

 

+ +
@stop \ No newline at end of file diff --git a/composer.json b/composer.json index 8784744b3d89..541d68ee88c4 100644 --- a/composer.json +++ b/composer.json @@ -20,16 +20,16 @@ "intervention/image": "1.x", "webpatser/laravel-countries": "dev-master", "barryvdh/laravel-ide-helper": "~1.0", - "doctrine/dbal": "~2.3", - "jsanc623/phpbenchtime": "2.x", - "lokielse/omnipay-alipay": "dev-master", - "coatesap/omnipay-datacash": "~2.0", - "alfaproject/omnipay-neteller": "~1.0", - "mfauveau/omnipay-pacnet": "~2.0", - "coatesap/omnipay-paymentsense": "~2.0", - "coatesap/omnipay-realex": "~2.0", - "fruitcakestudio/omnipay-sisow": "~2.0", - "alfaproject/omnipay-skrill": "dev-master" + "doctrine/dbal": "~2.3", + "jsanc623/phpbenchtime": "2.x", + "lokielse/omnipay-alipay": "dev-master", + "coatesap/omnipay-datacash": "~2.0", + "alfaproject/omnipay-neteller": "~1.0", + "mfauveau/omnipay-pacnet": "~2.0", + "coatesap/omnipay-paymentsense": "~2.0", + "coatesap/omnipay-realex": "~2.0", + "fruitcakestudio/omnipay-sisow": "~2.0", + "alfaproject/omnipay-skrill": "dev-master" }, "require-dev": { "codeception/codeception": "dev-master"