implemented login and logout