30 lines
		
	
	
		
			762 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			762 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->forceFill([
 | 
						|
            'password' => Hash::make($input['password']),
 | 
						|
        ])->save();
 | 
						|
        $user->deleteAllSessions();
 | 
						|
    }
 | 
						|
}
 |