function of login and logout