vito/app/Actions/User/ResetUserPassword.php
Saeed Vaziry 9030427f78
Two factor (#47)
* init 2fa

* fix code style
2023-09-11 20:47:44 +02:00

30 lines
690 B
PHP

<?php
namespace App\Actions\User;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;
/**
* Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/
public function reset(User $user, array $input): void
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}