Add function for login. close #1.