Refactoring: login controller