handle disconnect and logout in the same way