add login and logout function