| Total Complexity | 1 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class UpdateUserPassword implements UpdatesUserPasswords |
||
| 11 | { |
||
| 12 | use Fortify\PasswordValidationRules; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Validate and update the user's password. |
||
| 16 | * |
||
| 17 | * @param array<string, string> $input |
||
| 18 | */ |
||
| 19 | public function update(User $user, array $input): void |
||
| 20 | { |
||
| 21 | Validator::make($input, [ |
||
| 22 | 'current_password' => ['required', 'string', 'current_password:web'], |
||
| 23 | 'password' => $this->passwordRules(), |
||
| 24 | ], [ |
||
| 25 | 'current_password.current_password' => __('The provided password does not match your current password.'), |
||
| 26 | ])->validateWithBag('password'); |
||
| 27 | |||
| 28 | $user->forceFill([ |
||
| 29 | 'password' => Hash::make($input['password']), |
||
| 30 | ])->save(); |
||
| 31 | } |
||
| 33 |