Rewrite login logic

The current implementation of the login logic is hard to maintain, especially after the userinfo is split into multiple resource classes. A new version should be implemented, where all necessary fields are set from one place and the dataflow is clearer.

Edited by Péter Kaszab