public function resetPassword(User $user, string $newPassword)
    {
        $this->enforcePasswordStrength($newPassword);

        $auth = $this->authenticationProvider->findByUserId($user->getId());
        if (!$auth) {
            throw new NoSuchUserException();
        }

        $hash = password_hash($newPassword, PASSWORD_DEFAULT);
        $auth->setHash($hash);
        $this->resetAuthenticationKey($auth);
        $this->authenticationProvider->update($auth);
    }
public function resetPassword(User $user, string $newPassword)
    {
        $this->enforcePasswordStrength($newPassword);

        $auth = $this->authenticationProvider->findByUserId($user->getId());
        if (!$auth) {
            throw new NoSuchUserException();
        }

        $hash = password_hash($newPassword, PASSWORD_DEFAULT);
        $auth->setHash($hash);
        $this->resetAuthenticationKey($auth);
        $this->authenticationProvider->update($auth);
    }
public function resetPassword ( User $ user , string $ newPassword ) { $ this -> enforcePasswordStrength ( $ newPassword ) ; $ auth = $ this -> authenticationProvider -> findByUserId ( $ user -> getId ( ) ) ; if ( ! $ auth ) { throw new NoSuchUserException ( ) ; } $ hash = password_hash ( $ newPassword , PASSWORD_DEFAULT ) ; $ auth -> setHash ( $ hash ) ; $ this -> resetAuthenticationKey ( $ auth ) ; $ this -> authenticationProvider -> update ( $ auth ) ; }
Reset this user's password

@param User   $user        The user to whom this password gets assigned
@param string $newPassword Cleartext password that's being hashed

@throws NoSuchUserException
@throws WeakPasswordException
Reset this user s password