Extract zhdk_login into gem; refactory & cleanup