I suggest you do some reading on the action. The WP docs are a better resource than me on this. I won’t be able to figure out how best to integrate your custom WP login code here unfortunately. In terms of the issue you’re having, I think we’ve got to the bottom of it.