update the login and logout function