implementing login and logout functionality