Get login working.

Add code to allow for login and logout.