added user login and logout functions