From 230c9da1df3909350778cf78edc5728e95869c20 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 13 Feb 2019 21:30:15 -0800 Subject: [PATCH] Fixed #6703 - fixes password confirmation --- app/Http/Controllers/ProfileController.php | 3 +-- app/Http/Requests/SaveUserRequest.php | 6 +++--- app/Http/Requests/SetupUserRequest.php | 3 +-- resources/lang/en/validation.php | 1 + resources/views/account/change-password.blade.php | 6 +++--- resources/views/modals/user.blade.php | 6 +++--- resources/views/setup/user.blade.php | 2 +- resources/views/users/edit.blade.php | 8 ++++---- tests/acceptance/UsersCept.php | 4 ++-- tests/functional/UsersCest.php | 2 +- 10 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 492b65db0b..daa10aa974 100755 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -125,8 +125,7 @@ class ProfileController extends Controller $rules = array( 'current_password' => 'required', - 'password' => Setting::passwordComplexityRulesSaving('store'), - 'password_confirm' => 'required|same:password', + 'password' => Setting::passwordComplexityRulesSaving('store').'|confirmed', ); $validator = \Validator::make($request->all(), $rules); diff --git a/app/Http/Requests/SaveUserRequest.php b/app/Http/Requests/SaveUserRequest.php index b721ed0e9e..c577b53ce2 100644 --- a/app/Http/Requests/SaveUserRequest.php +++ b/app/Http/Requests/SaveUserRequest.php @@ -37,7 +37,7 @@ class SaveUserRequest extends Request $rules['username'] = 'required_unless:ldap_import,1|string|min:1'; if ($this->request->get('ldap_import') == false) { - $rules['password'] = Setting::passwordComplexityRulesSaving('store'); + $rules['password'] = Setting::passwordComplexityRulesSaving('store').'|confirmed'; } break; } @@ -46,7 +46,7 @@ class SaveUserRequest extends Request case 'PUT': $rules['first_name'] = 'required|string|min:1'; $rules['username'] = 'required_unless:ldap_import,1|string|min:1'; - $rules['password'] = Setting::passwordComplexityRulesSaving('update'); + $rules['password'] = Setting::passwordComplexityRulesSaving('update').'|confirmed'; break; // Save only what's passed @@ -59,7 +59,7 @@ class SaveUserRequest extends Request default:break; } - $rules['password_confirm'] = 'sometimes|required_with:password'; + \Log::debug($rules); return $rules; diff --git a/app/Http/Requests/SetupUserRequest.php b/app/Http/Requests/SetupUserRequest.php index a3a6631909..a58595f757 100644 --- a/app/Http/Requests/SetupUserRequest.php +++ b/app/Http/Requests/SetupUserRequest.php @@ -29,8 +29,7 @@ class SetupUserRequest extends Request 'last_name' => 'required|string|min:1', 'username' => 'required|string|min:2|unique:users,username,NULL,deleted_at', 'email' => 'email|unique:users,email', - 'password' => 'required|min:6', - 'password_confirm' => 'required|min:6|same:password', + 'password' => 'required|min:6|confirmed', 'email_domain' => 'required|min:4', ]; } diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 23116776e3..5c07347013 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -42,6 +42,7 @@ return array( 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', + 'hashed_pass' => 'Your password is incorrect.', 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', 'in_array' => 'The :attribute field does not exist in :other.', diff --git a/resources/views/account/change-password.blade.php b/resources/views/account/change-password.blade.php index e612769eb2..4dbc3bb485 100755 --- a/resources/views/account/change-password.blade.php +++ b/resources/views/account/change-password.blade.php @@ -37,11 +37,11 @@ -
+
- - {!! $errors->first('password_confirm', ' :message') !!} + + {!! $errors->first('password_confirmation', ' :message') !!} @if (config('app.lock_passwords'))

{{ trans('admin/users/table.lock_passwords') }}

@endif diff --git a/resources/views/modals/user.blade.php b/resources/views/modals/user.blade.php index 7aec3ee9de..151254fc5c 100644 --- a/resources/views/modals/user.blade.php +++ b/resources/views/modals/user.blade.php @@ -14,7 +14,7 @@ 'numbers': true, 'specialChars': true, 'onPasswordGenerated': function (generatedPassword) { - $('#modal-password_confirm').val($('#modal-password').val()); + $('#modal-password_confirmation').val($('#modal-password').val()); } }); }); @@ -52,8 +52,8 @@
-
-
+
+
diff --git a/resources/views/setup/user.blade.php b/resources/views/setup/user.blade.php index ad6ed17593..6459a4a3b4 100644 --- a/resources/views/setup/user.blade.php +++ b/resources/views/setup/user.blade.php @@ -150,7 +150,7 @@ Create a User ::
{{ Form::label('password_confirmation', trans('admin/users/table.password_confirm')) }} - {{ Form::password('password_confirm', array('class' => 'form-control')) }} + {{ Form::password('password_confirmation', array('class' => 'form-control')) }} {!! $errors->first('password_confirmation', ':message') !!}
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 4f8247af1e..172448be09 100755 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -163,14 +163,14 @@ @if ($user->ldap_import!='1') -
-