Add logout command

Close #6719