Jarir reported: I asked the Messenger of Allah, peace and blessings be upon him, about accidentally glancing at a woman. The Prophet ordered me to look the other way.
Source: Ṣaḥīḥ Muslim 2159
Grade: Sahih (authentic) according to Muslim
عَنْ جَرِيرٍ قَالَ سَأَلْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ عَنْ نَظَرِ الْفُجَاءَةِ فَأَمَرَنِي أَنْ أَصْرِفَ بَصَرِي
2159 صحيح مسلم كتاب الآداب باب نظر الفجاءة