Conditions | 2 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function rules(): array |
||
13 | { |
||
14 | return [ |
||
15 | 'password' => [ |
||
16 | 'required', |
||
17 | 3 | 'string', |
|
18 | 'min:10', |
||
19 | 3 | 'confirmed', |
|
20 | ], |
||
21 | 'current_password' => [ |
||
22 | 'required', |
||
23 | 'string', |
||
24 | function ($attribute, $value, $fail) { |
||
25 | /** @var \App\Models\User $user */ |
||
26 | $user = $this->user(); |
||
27 | 3 | ||
28 | /** @var Hasher $hasher */ |
||
29 | $hasher = $this->container->make(Hasher::class); |
||
30 | |||
31 | 3 | if (! $hasher->check($value, $user->getAuthPassword())) { |
|
32 | $fail('Current password is invalid.'); |
||
33 | } |
||
39 |