Added login function to controller and service.