Implemented login function. (Feiyu)