Refactor login logic to the login widget.

**DO NOT MERGE**

A little work needs to be done yet.
more generally, the conditions that won't do anything (not what wait_to_login is, but when it's that supposed to happen, and offline flag). I'd have it commented it on the docstring for the public method. In the ini it's good to have a comment about the variable _wait_to_init, but that's an implementation detail only.