login() and watchHistory() functions