check_login_form_submission() factored in separate function