Answered by Shaykh Faraz Rabbani
Can you pray behind somebody who commits haram actions?
Walaikum assalam wa rahmatullah,
The prayer itself would be valid, but it is highly blameworthy to choose an openly corrupt person. It is better to pray behind such a person than to pray alone, though. [Ibn Abidin, Radd al-Muhtar]
Wassalam,
Faraz Rabbani