Fix login validation when multiple login forms are present (Closes #356)