created functions to login and logout