begin login and logout