functional login and logout