Modified to become a logout state. #46

Please review #46 ,and merge to master branch.

test is all OK.