Improve and fix login controller.