UPDATED refactoring the login controller and service.