When a dissolution of marriage is granted to a person who shall, in good faith, have intermarried with a person having at the time of such marriage, another spouse or spouses living, the court may, nevertheless, allow the petitioner maintenance in the same manner as in other cases of dissolution of marriage; but no such allowance shall be made as will be inconsistent with the rights of such other spouse or spouses, which shall first be ascertained by the court before the granting of such maintenance.
750 ILCS 5/702