Modified to become a logout state. #46

Please review #46 ,and merge to 1.0.x branch.

test is all OK !