Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:135

And those who, when they commit an immorality or wrong themselves ˹by transgression˺, remember Allah and seek forgiveness for their sins - and who can forgive sins except Allah? - and ˹who˺ do not persist in what they have done while they know.  

And who when they commit an indecency, a despicable sin such as adultery, or wrong themselves, with less than that, such as a kiss, remember God, that is to say, His threat of punishment, and pray forgiveness for their sins — and who, that is, none, shall forgive sins but God? — and who do not persist, persevere, in what they did, but have desisted from it, knowing, that what they did was sinful.
القرآن:٣:١٣٥

وَالَّذِينَ إِذَا فَعَلُوا فَاحِشَةً أَوْ ظَلَمُوا أَنْفُسَهُمْ ذَكَرُوا اللَّهَ فَاسْتَغْفَرُوا لِذُنُوبِهِمْ وَمَنْ يَغْفِرُ الذُّنُوبَ إِلَّا اللَّهُ وَلَمْ يُصِرُّوا عَلَىٰ مَا فَعَلُوا وَهُمْ يَعْلَمُونَ  

{والذين إذا فعلوا فاحشة} ذنبا قبيحا كالزنا {أو ظلموا أنفسهم} بدونه كالقُبلة {ذكروا الله} أي وعيده {فاستغفروا لذنوبهم ومن} أي لا {يغفر الذنوب إلا الله ولم يصروا} يداوموا {على ما فعلوا} بل أقلعوا عنه {وهم يعلمون} أن الذي أتوه معصية.