It is narrated from Sayyidah Umm Salamah (may Allah be pleased with her) that the Messenger of Allah (peace and blessings be upon him) said: "It is not proper for anyone to remain in this mosque in a state of major ritual impurity (janabah) except me and Ali."
Hadith Referenceالمعجم الكبير للطبراني / مسند النساء / 20183