Logout before login if needed.