Extracted logon process out of hypersocket-core.js.