I heard a Hadeeth that says on the Day of Judgement a person who in this Life used to fast and pray and do Qiyam and a lot of good deeds would have all his good deeds blown away because when he was alone and no one could see him he would sin a lot "To violate Allaah's Commands", how can such a person repent and what is the best way to gain the Pleasure of Allaah and avoid His Anger.
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
The Prophetic narration that the questioner quoted is authentic. Thawbaan narrated that the Prophet said: "Indeed I know a type of people from my nation who would come on the Day of Judgement with good deeds as big as the mountains of Tihaamah, pure, but Allaah will turn them into scattered dust." Thawbaan asked in fear: "O Prophet of Allaah! Describe them to us, we fear to be amongst them while we do not know." Thereupon, the Prophet said: "Indeed they are your brothers, and they perform acts of worship by night [prayers] in the same way you do, but when they are alone, they transgress the Limits of Allaah." [Ibn Maajah and At-Tabaraani] What is meant in the narration are the people who refrain from committing sins and pretend to be righteous when in the presence of other people, but as soon as they are alone, far from people's sight, they will quickly transgress the Limits of Allaah. So such people did not fear Allaah and did not have consciousness that Allaah is watching them all the time, rather they feared the people.
Therefore, whoever knows that he has done this, should sincerely repent to Allaah and fear Him in public and in private and refrain from committing sins as he refrains from committing them while in the presence of other people. Besides, he should hold Allaah high in esteem more than considering people in such a position. For details about repentance, please refer to Fatwa: 87903.
As regards a person who commits some sins when he is alone and he regrets and endeavours not to sin again but he sometimes feels weak and commits the sins without continuity, then it is hoped that he is not included in the threat that is mentioned in the narration. However, he should be careful not to be amongst them as the outcome is not secure.
We ask Allaah to take our souls while performing good deeds.
Allaah knows best.
You can search for fatwa through many choices