The Messenger of Allah ﷺ said, "There are three things no one is permitted to do. A man must not lead a people in prayer and then single himself out with supplication to their exclusion, for if he does so he has betrayed them. He must not peer into the interior of a house before seeking permission to enter, for if he does so it is as though he has already entered. And he must not pray while needing to relieve himself until he has eased himself."
حدثنا محمد بن عيسى حدثنا ابن عياش عن حبيب بن صالح عن يزيد بن شريح الحضرمي عن أبي حي المؤذن
قال رسول الله ﷺ ثلاث لا يحل لأحد أن يفعلهن لا يؤم رجل قوما فيخص نفسه بالدعاء دونهم فإن فعل فقد خانهم ولا ينظر في قعر بيت قبل أن يستأذن فإن فعل فقد دخل ولا يصلي وهو حقن حتى يتخفف
[Hasan] Tirmidhi reported it in the Book of Prayer, chapter on the dislike of an imam singling himself out in supplication, hadith no. 357, from the hadith of Ismail bin Ayyash through this route, and Baqiyyah corroborated him, as reported by Ibn Majah, hadith nos. 619 and 923.