Answer
(Fatwa: 716/664=L/1429)
Shaving is a major sin and the imamah of one who commits it is makrooh-e-tahreemi. However, if there is no other reason and no pious and righteous imam is available nearby then one should perform salah behind the same imam instead of performing individually: قال علیہ السلام: صلو خلف کل بر و فاجر
Also, the scholars of Fiqh have written that one gets the reward of Jamat though the imam is fasiq, but the reward can not be obtained by offering salah individually:
صلی خلف فاسق او مبتدع نال فضل الجماعۃ، وفی الشامیۃ: افاد ان الصلاۃ خلفھما اولی من الانفراد (الشامی: 2/301)
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband