Refactor setLogin method