If a person does something contrary to the Shari?ah, he should offer two Rakaats of Nafl Salaat and thereafter repent to Allah Ta’ala with full devotion and humility.
He should also express his regret for committing that sin. He should seek forgiveness from Allah Ta’ala and make a firm intention that he will not commit that sin in the future. Through the virtue and bounty of Allah Ta’ala, that sin will be forgiven. (Bahishti Zewar vol.1 pg.270)
and Allah Ta’ala Knows Best
Mufti Ebrahim Desai