It is narrated from Imam Mahdi (AJ) who said: every one of you must act in ways which result in your closeness to us and in attaining our friendship; and must stay away from behaviours which make us unhappy and angry; how often a person repents in moments which is of no benefit to him/her and does not save him/her from Divine Punishments [1].
[1] Beharul Anwaar, Vol. 53, Page 176, attachment to Hadith 7, narrated from Ihtejaj.
source : shafaqna