Introduce add_condition and tweak login workflow