Are all of the files and OSGi bundles that are on Author (where it's working) on PUBLISH.
In the login article we have where we use the Default security hook that AEM Provides for log in functionality:
var valid = validateForm();
if(valid){
$.ajax({type: "POST",
url: $('#url').val(),
data: { j_username: $("#userId").val(), j_password: $("#inputPassword").val(),j_validate: "true" },
success:function(data,textStatus,jqXHR ){;
window.location.href=getRedirectPath();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$("#errordiv").val("Invalid User Name or Password");
}});
} else{
$("#errordiv").val("Invalid User Name or Password");
}
});
});
All the same content must be on Publish Server. Usually when something works on Author and not Publish - settings or content are not located on the PUB instance.