public function resetPassword($token, $password)
    {
        $this->cleanResetTokens = true;

        /** @var PasswordResetToken $token */
        $token = $this->getEntityManager()->find(PasswordResetToken::class, $token);

        if (!$token) {
            throw new TokenNotFoundException;
        }

        $user = $token->getUser();
        $user->setPassword($password);

        $em = $this->getEntityManager();
        $em->remove($token);
        $em->flush();

        return $user;
    }