Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix current password validation #98

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions wave/src/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,14 @@ public function profilePut(Request $request){
public function securityPut(Request $request){

$validator = Validator::make($request->all(), [
'current_password' => 'required',
'current_password' => 'required|current_password',
'password' => 'required|confirmed|min:'.config('wave.auth.min_password_length'),
]);

if ($validator->fails()) {
return back()->with(['message' => $validator->errors()->first(), 'message_type' => 'danger']);
}

if (! Hash::check($request->current_password, $request->user()->password)) {
return back()->with(['message' => 'Incorrect current password entered.', 'message_type' => 'danger']);
}

auth()->user()->forceFill([
'password' => bcrypt($request->password)
])->save();
Expand Down
2 changes: 1 addition & 1 deletion wave/src/Http/Livewire/Settings/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Security extends Component
protected function rules()
{
return [
'current_password' => 'required',
'current_password' => 'required|current_password',
'password' => 'required|confirmed|min:'.config('wave.auth.min_password_length')
];
}
Expand Down