Build login and logout functionality.