You've already forked Atomcms-edit
32 lines
774 B
PHP
Executable File
32 lines
774 B
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\Fortify;
|
|
|
|
use App\Actions\Fortify\Rules\PasswordValidationRules;
|
|
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;
|
|
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
*/
|
|
public function reset(User $user, array $input): void
|
|
{
|
|
Validator::make($input, [
|
|
'password' => $this->passwordRules(),
|
|
])->validate();
|
|
|
|
$password = $input['password'] ?? '';
|
|
$user->forceFill([
|
|
'password' => Hash::make(is_string($password) ? $password : ''),
|
|
])->save();
|
|
}
|
|
}
|