Refactor logout action of user.