I'd step through login in a debugger and see where it hangs. If you cannot do that, then start inserting debugging print statements and binary search where it hangs.