process login and logout