Complete the functions and tests about login and logout.

之前那个搞错了