Finish login and logout