Added/fixed user login and logout.