added isValidLoginForm and mungeLoginFormData functions