Implement login and logout.