use cookie to track login status and update doc