Added handling for user login/register as well as logout.