Added login and logout functionality.