finish login and logout