working login and logout functionality