Update to only ask for login if needed and handles logout.