Passed
Branch main (b90ec4)
by Thierry
20:23 queued 14:04
created

ResetUserPassword   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1
1
<?php
2
3
namespace App\Actions\Fortify;
4
5
use Illuminate\Support\Facades\Hash;
6
use Illuminate\Support\Facades\Validator;
7
use Laravel\Fortify\Contracts\ResetsUserPasswords;
8
use Siak\Tontine\Model\User;
9
10
class ResetUserPassword implements ResetsUserPasswords
11
{
12
    use PasswordValidationRules;
13
14
    /**
15
     * Validate and reset the user's forgotten password.
16
     *
17
     * @param  array<string, string>  $input
18
     */
19
    public function reset(User $user, array $input): void
20
    {
21
        Validator::make($input, [
22
            'password' => $this->passwordRules(),
23
        ])->validate();
24
25
        $user->forceFill([
26
            'password' => Hash::make($input['password']),
27
        ])->save();
28
    }
29
}
30