Set connected to false on disconnect

Make leave dialog only pop up when connected and logged in by returning a message, otherwise implicitly return undefined preventing the dialog box from popping open.