The court, upon the granting of final judgment of divorce or an order of separate maintenance, may allow a party to resume a former surname or the surname of a former spouse.