Some LoginController refactoring.