Remove redundancy in login()