add logout function and add session for login