Files
coolify/app/Actions/Fortify/ResetUserPassword.php
T
Andras Bacsai 96ed09f0cc fix(auth): clear forced password reset after a password reset
An invited user who set a password with Forgot password kept the forced
reset flag. A re-invite then replaced the password, and a revoked or
expired invitation deleted the account.
2026-10-29 18:16:00 +01:00

31 lines
802 B
PHP

<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rules\Password;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
class ResetUserPassword implements ResetsUserPasswords
{
/**
* 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' => ['required', Password::defaults(), 'confirmed'],
])->validate();
$user->fill([
'password' => Hash::make($input['password']),
'force_password_reset' => false,
])->save();
$user->deleteAllSessions();
}
}