complete login and logout process