Implement "Logout when leaving app" setting.