Five conditions for taubah(repentance) to be accepted:
1- Ikhlaas (sincerity) for the sake of Allaah, alone; some people repent for the sake of people. Or for the sake of life, for example a smoker, will keep smoking even if he knows it is haraam, until he gets bad news from the doctor. So he’s only stopping because he wants to live longer, so this is NOT repentance. Allaah will still take him to account for all the years that he spent smoking because he didn’t really repent for the sin.
2-Regret– Feeling remorse/guilt that you sinned. Ibn Mas’oud said “A believer sees his sins as if he were sitting under a mountain which, he is afraid, may fall on him; whereas the wicked person considers his sins as flies passing over his nose and he just drives them away like this.” Abu Shihab (the sub narrator) moved his hand over his nose in illustration. (Bukhaari Book 80, Hadith 6381)
The very feeling of guilt is a good indication from Allaah that the heart is alive. If this doesn’t happen then there is NO repentance.
3-You must leave the sin alone. At the time of repentance you must resolve to not do it again. You may fall in to the sin again but if one intends to never to do it again sincerely, then the original repentance is not invalidated. Allaah knows if you are sincere, so you just need to do taubah again.
4-You must make taubah before the time for taubah comes to an end. Either when the sun rises from the west or when the soul reaches the collar bone at the time of death. Abu Moosa al-Ash’ari narrates that the Prophet (صلى الله عليه و سلم) said:
“Allaah spreads out His hand at night to accept the repentance of the one who sinned during the day, and He spreads out His hand by day to accept the repentance of the one who sinned during the night (and that will continue) until the sun rises from the west.” (Muslim 2759)
Abu ‘Abd al-Rahmaan ‘Abd-Allaah ibn ‘Umar ibn al-Khattab that the Prophet (صلى الله عليه و سلم) said :
“Allaah will accept the repentance of His slave so long as the death-rattle has not yet reached his throat.” (Narrated by al-Tirmidhi 3537; classed as hasan by al-Albaani)
5- If it involves the rights of people then you must give back their right. If a man steals money from someone and then repents, he cannot keep what he stole, he must give it back, otherwise taubah is not accepted.