Refactor login logic to the login widget.

**DO NOT MERGE**

A little work needs to be done yet.
in case it wasn't clear, I was just suggesting hiding state behind a single object on this take, not tackling the move to backend yet, it might make sense to do that when similar pullreqs are merged for the rest of the ~~mess~~ stuff