finished user login and logout function.