Refactor login logic to the login widget.

**DO NOT MERGE**

A little work needs to be done yet.
right, inheritance! ... my brain is almost in weekend mode :P